Skip to content

Commit abae00c

Browse files
wraithgarnlf
authored andcommitted
docs(npm): update npm command docs
These are the base docs for the npm cli itself that populates `man npm`, Mostly grammar fixes, some additions and clarifications in places, new links to some appropriate other docs PR-URL: #2565 Credit: @wraithgar Close: #2565 Reviewed-by: @nlf
1 parent 52e8a1a commit abae00c

File tree

1 file changed

+60
-45
lines changed

1 file changed

+60
-45
lines changed

docs/content/commands/npm.md

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,42 @@ npm is the package manager for the Node JavaScript platform. It puts
2020
modules in place so that node can find them, and manages dependency
2121
conflicts intelligently.
2222

23-
It is extremely configurable to support a wide variety of use cases.
24-
Most commonly, it is used to publish, discover, install, and develop node
23+
It is extremely configurable to support a variety of use cases. Most
24+
commonly, you use it to publish, discover, install, and develop node
2525
programs.
2626

2727
Run `npm help` to get a list of available commands.
2828

2929
### Important
3030

31-
npm is configured to use npm, Inc.'s public registry at
31+
npm comes preconfigured to use npm's public registry at
3232
https://registry.npmjs.org by default. Use of the npm public registry is
33-
subject to terms of use available at https://www.npmjs.com/policies/terms.
33+
subject to terms of use available at
34+
https://www.npmjs.com/policies/terms.
3435

35-
You can configure npm to use any compatible registry you like, and even run
36-
your own registry. Use of someone else's registry may be governed by their
37-
terms of use.
36+
You can configure npm to use any compatible registry you like, and even
37+
run your own registry. Use of someone else's registry is governed by
38+
their terms of use.
3839

3940
### Introduction
4041

4142
You probably got npm because you want to install stuff.
4243

43-
Use `npm install blerg` to install the latest version of "blerg". Check out
44-
[`npm install`](/commands/npm-install) for more info. It can do a lot of stuff.
44+
The very first thing you will most likely want to run in any node
45+
program is `npm install` to install its dependencies.
4546

46-
Use the `npm search` command to show everything that's available.
47-
Use `npm ls` to show everything you've installed.
47+
You can also run `npm install blerg` to install the latest version of
48+
"blerg". Check out [`npm install`](/commands/npm-install) for more
49+
info. It can do a lot of stuff.
50+
51+
Use the `npm search` command to show everything that's available in the
52+
public registry. Use `npm ls` to show everything you've installed.
4853

4954
### Dependencies
5055

51-
If a package references to another package with a git URL, npm depends
52-
on a preinstalled git.
56+
If a package lists a dependency using a git URL, npm will install that
57+
dependency using the [`git`](https://github.com/git-guides/install-git)
58+
command and will generate an error if it is not installed.
5359

5460
If one of the packages npm tries to install is a native node module and
5561
requires compiling of C++ Code, npm will use
@@ -64,41 +70,45 @@ the [node-gyp Wiki](https://github.com/nodejs/node-gyp/wiki).
6470

6571
### Directories
6672

67-
See [`folders`](/configuring-npm/folders) to learn about where npm puts stuff.
73+
See [`folders`](/configuring-npm/folders) to learn about where npm puts
74+
stuff.
6875

6976
In particular, npm has two modes of operation:
7077

71-
* global mode:
72-
npm installs packages into the install prefix at
73-
`prefix/lib/node_modules` and bins are installed in `prefix/bin`.
7478
* local mode:
7579
npm installs packages into the current project directory, which
76-
defaults to the current working directory. Packages are installed to
77-
`./node_modules`, and bins are installed to `./node_modules/.bin`.
80+
defaults to the current working directory. Packages install to
81+
`./node_modules`, and bins to `./node_modules/.bin`.
82+
* global mode:
83+
npm installs packages into the install prefix at
84+
`$npm_config_prefix/lib/node_modules` and bins to
85+
`$npm_config_prefix/bin`.
7886

7987
Local mode is the default. Use `-g` or `--global` on any command to
80-
operate in global mode instead.
88+
run in global mode instead.
8189

8290
### Developer Usage
8391

8492
If you're using npm to develop and publish your code, check out the
8593
following help topics:
8694

8795
* json:
88-
Make a package.json file. See [`package.json`](/configuring-npm/package-json).
96+
Make a package.json file. See
97+
[`package.json`](/configuring-npm/package-json).
8998
* link:
90-
For linking your current working code into Node's path, so that you
91-
don't have to reinstall every time you make a change. Use
92-
`npm link` to do this.
99+
Links your current working code into Node's path, so that you don't
100+
have to reinstall every time you make a change. Use [`npm
101+
link`](/commands/npm-link) to do this.
93102
* install:
94-
It's a good idea to install things if you don't need the symbolic link.
95-
Especially, installing other peoples code from the registry is done via
96-
`npm install`
103+
It's a good idea to install things if you don't need the symbolic
104+
link. Especially, installing other peoples code from the registry is
105+
done via [`npm install`](/commands/npm-install)
97106
* adduser:
98-
Create an account or log in. Credentials are stored in the
99-
user config file.
107+
Create an account or log in. When you do this, npm will store
108+
credentials in the user config file config file.
100109
* publish:
101-
Use the `npm publish` command to upload your code to the registry.
110+
Use the [`npm publish`](/commands/npm-publish`) command to upload your
111+
code to the registry.
102112

103113
#### Configuration
104114

@@ -108,20 +118,20 @@ npm is extremely configurable. It reads its configuration options from
108118
* Command line switches:
109119
Set a config with `--key val`. All keys take a value, even if they
110120
are booleans (the config parser doesn't know what the options are at
111-
the time of parsing). If no value is provided, then the option is set
112-
to boolean `true`.
121+
the time of parsing). If you do not provide a value (`--key`) then
122+
the option is set to boolean `true`.
113123
* Environment Variables:
114124
Set any config by prefixing the name in an environment variable with
115125
`npm_config_`. For example, `export npm_config_key=val`.
116126
* User Configs:
117-
The file at $HOME/.npmrc is an ini-formatted list of configs. If
127+
The file at `$HOME/.npmrc` is an ini-formatted list of configs. If
118128
present, it is parsed. If the `userconfig` option is set in the cli
119-
or env, then that will be used instead.
129+
or env, that file will be used instead.
120130
* Global Configs:
121-
The file found at ../etc/npmrc (from the node executable, by default
122-
this resolves to /usr/local/etc/npmrc) will be parsed if it is found.
123-
If the `globalconfig` option is set in the cli, env, or user config,
124-
then that file is parsed instead.
131+
The file found at `./etc/npmrc` (relative to the global prefix will be
132+
parsed if it is found. See [`npm prefix`](/commands/npm-prefix) for
133+
more info on the global prefix. If the `globalconfig` option is set
134+
in the cli, env, or user config, then that file is parsed instead.
125135
* Defaults:
126136
npm's default configuration options are defined in
127137
lib/utils/config-defs.js. These must not be changed.
@@ -132,15 +142,17 @@ See [`config`](/using-npm/config) for much much more information.
132142

133143
Patches welcome!
134144

135-
If you would like to contribute, but don't know what to work on, read
136-
the [contributing guidelines](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md)
137-
and check the issues list.
145+
If you would like to help, but don't know what to work on, read the
146+
[contributing
147+
guidelines](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md) and
148+
check the issues list.
138149

139150
### Bugs
140151

141-
When you find issues, please report them: <https://github.com/npm/cli/issues>
152+
When you find issues, please report them:
153+
<https://github.com/npm/cli/issues>
142154

143-
Be sure to follow the template and bug reporting guidelines.
155+
Please be sure to follow the template and bug reporting guidelines.
144156

145157
### Feature Requests
146158

@@ -153,8 +165,11 @@ Or suggest formal RFC proposals:
153165
* <https://github.com/npm/rfcs>
154166

155167
### See Also
168+
156169
* [npm help](/commands/npm-help)
157170
* [package.json](/configuring-npm/package-json)
158-
* [npm install](/commands/npm-install)
159-
* [npm config](/commands/npm-config)
160171
* [npmrc](/configuring-npm/npmrc)
172+
* [npm config](/commands/npm-config)
173+
* [npm install](/commands/npm-install)
174+
* [npm prefix](/commands/npm-prefix)
175+
* [npm publish](/commands/npm-publish)

0 commit comments

Comments
 (0)