Skip to content

Commit 39c2f2e

Browse files
Max Blackowlstronaut
authored andcommitted
docs: add examples for command line flags including --prefix
1 parent 1298530 commit 39c2f2e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

docs/lib/content/using-npm/config.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ Using `--flag` without specifying any value will set the value to `true`.
2020
Example: `--flag1 --flag2` will set both configuration parameters to `true`, while `--flag1 --flag2 bar` will set `flag1` to `true`, and `flag2` to `bar`.
2121
Finally, `--flag1 --flag2 -- bar` will set both configuration parameters to `true`, and the `bar` is taken as a command argument.
2222

23+
**Common examples:**
24+
25+
* `npm install --prefix /path/to/dir` - Runs npm commands in a different directory without changing the current working directory
26+
* `npm install --global` - Installs packages globally (shorthand: `-g`)
27+
* `npm install --save-dev` - Saves to devDependencies (shorthand: `-D`)
28+
29+
Any configuration option documented in the [Config Settings](#config-settings) section below can be set via command line flags using `--option-name value` syntax.
30+
2331
#### Environment Variables
2432

2533
Any environment variables that start with `npm_config_` will be interpreted as a configuration parameter.

0 commit comments

Comments
 (0)