@@ -20,36 +20,42 @@ npm is the package manager for the Node JavaScript platform. It puts
20
20
modules in place so that node can find them, and manages dependency
21
21
conflicts intelligently.
22
22
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
25
25
programs.
26
26
27
27
Run ` npm help ` to get a list of available commands.
28
28
29
29
### Important
30
30
31
- npm is configured to use npm, Inc. 's public registry at
31
+ npm comes preconfigured to use npm's public registry at
32
32
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 .
34
35
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.
38
39
39
40
### Introduction
40
41
41
42
You probably got npm because you want to install stuff.
42
43
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 .
45
46
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.
48
53
49
54
### Dependencies
50
55
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.
53
59
54
60
If one of the packages npm tries to install is a native node module and
55
61
requires compiling of C++ Code, npm will use
@@ -64,41 +70,45 @@ the [node-gyp Wiki](https://github.com/nodejs/node-gyp/wiki).
64
70
65
71
### Directories
66
72
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.
68
75
69
76
In particular, npm has two modes of operation:
70
77
71
- * global mode:
72
- npm installs packages into the install prefix at
73
- ` prefix/lib/node_modules ` and bins are installed in ` prefix/bin ` .
74
78
* local mode:
75
79
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 ` .
78
86
79
87
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.
81
89
82
90
### Developer Usage
83
91
84
92
If you're using npm to develop and publish your code, check out the
85
93
following help topics:
86
94
87
95
* 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 ) .
89
98
* 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.
93
102
* 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 )
97
106
* 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.
100
109
* 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.
102
112
103
113
#### Configuration
104
114
@@ -108,20 +118,20 @@ npm is extremely configurable. It reads its configuration options from
108
118
* Command line switches:
109
119
Set a config with ` --key val ` . All keys take a value, even if they
110
120
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 ` .
113
123
* Environment Variables:
114
124
Set any config by prefixing the name in an environment variable with
115
125
` npm_config_ ` . For example, ` export npm_config_key=val ` .
116
126
* 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
118
128
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.
120
130
* 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.
125
135
* Defaults:
126
136
npm's default configuration options are defined in
127
137
lib/utils/config-defs.js. These must not be changed.
@@ -132,15 +142,17 @@ See [`config`](/using-npm/config) for much much more information.
132
142
133
143
Patches welcome!
134
144
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.
138
149
139
150
### Bugs
140
151
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 >
142
154
143
- Be sure to follow the template and bug reporting guidelines.
155
+ Please be sure to follow the template and bug reporting guidelines.
144
156
145
157
### Feature Requests
146
158
@@ -153,8 +165,11 @@ Or suggest formal RFC proposals:
153
165
* < https://github.com/npm/rfcs >
154
166
155
167
### See Also
168
+
156
169
* [ npm help] ( /commands/npm-help )
157
170
* [ package.json] ( /configuring-npm/package-json )
158
- * [ npm install] ( /commands/npm-install )
159
- * [ npm config] ( /commands/npm-config )
160
171
* [ 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