1NPM(1) NPM(1)
2
3
4
6 npm - javascript package manager
7
8 Synopsis
9 npm <command> [args]
10
11 Version
12 8.0.0
13
14 Description
15 npm is the package manager for the Node JavaScript platform. It puts
16 modules in place so that node can find them, and manages dependency
17 conflicts intelligently.
18
19 It is extremely configurable to support a variety of use cases. Most
20 commonly, you use it to publish, discover, install, and develop node
21 programs.
22
23 Run npm help to get a list of available commands.
24
25 Important
26 npm comes preconfigured to use npm's public registry at https://reg‐
27 istry.npmjs.org by default. Use of the npm public registry is subject
28 to terms of use available at https://docs.npmjs.com/policies/terms.
29
30 You can configure npm to use any compatible registry you like, and even
31 run your own registry. Use of someone else's registry is governed by
32 their terms of use.
33
34 Introduction
35 You probably got npm because you want to install stuff.
36
37 The very first thing you will most likely want to run in any node pro‐
38 gram is npm install to install its dependencies.
39
40 You can also run npm install blerg to install the latest version of
41 "blerg". Check out npm help install for more info. It can do a lot of
42 stuff.
43
44 Use the npm search command to show everything that's available in the
45 public registry. Use npm ls to show everything you've installed.
46
47 Dependencies
48 If a package lists a dependency using a git URL, npm will install that
49 dependency using the git https://github.com/git-guides/install-git com‐
50 mand and will generate an error if it is not installed.
51
52 If one of the packages npm tries to install is a native node module and
53 requires compiling of C++ Code, npm will use node-gyp
54 https://github.com/nodejs/node-gyp for that task. For a Unix system,
55 node-gyp https://github.com/nodejs/node-gyp needs Python, make and a
56 buildchain like GCC. On Windows, Python and Microsoft Visual Studio C++
57 are needed. For more information visit the node-gyp repository
58 https://github.com/nodejs/node-gyp and the node-gyp Wiki
59 https://github.com/nodejs/node-gyp/wiki.
60
61 Directories
62 See npm help folders to learn about where npm puts stuff.
63
64 In particular, npm has two modes of operation:
65
66 • local mode: npm installs packages into the current project directory,
67 which defaults to the current working directory. Packages install to
68 ./node_modules, and bins to ./node_modules/.bin.
69
70 • global mode: npm installs packages into the install prefix at
71 $npm_config_prefix/lib/node_modules and bins to $npm_config_pre‐
72 fix/bin.
73
74
75 Local mode is the default. Use -g or --global on any command to run in
76 global mode instead.
77
78 Developer Usage
79 If you're using npm to develop and publish your code, check out the
80 following help topics:
81
82 • json: Make a package.json file. See npm help package.json.
83
84 • link: Links your current working code into Node's path, so that you
85 don't have to reinstall every time you make a change. Use npm help
86 npm link to do this.
87
88 • install: It's a good idea to install things if you don't need the
89 symbolic link. Especially, installing other peoples code from the
90 registry is done via npm help install
91
92 • adduser: Create an account or log in. When you do this, npm will
93 store credentials in the user config file config file.
94
95 • publish: Use the npm help publish command to upload your code to the
96 registry.
97
98
99 Configuration
100 npm is extremely configurable. It reads its configuration options from
101 5 places.
102
103 • Command line switches: Set a config with --key val. All keys take a
104 value, even if they are booleans (the config parser doesn't know what
105 the options are at the time of parsing). If you do not provide a
106 value (--key) then the option is set to boolean true.
107
108 • Environment Variables: Set any config by prefixing the name in an en‐
109 vironment variable with npm_config_. For example, export npm_con‐
110 fig_key=val.
111
112 • User Configs: The file at $HOME/.npmrc is an ini-formatted list of
113 configs. If present, it is parsed. If the userconfig option is set
114 in the cli or env, that file will be used instead.
115
116 • Global Configs: The file found at ./etc/npmrc (relative to the global
117 prefix will be parsed if it is found. See npm help prefix for more
118 info on the global prefix. If the globalconfig option is set in the
119 cli, env, or user config, then that file is parsed instead.
120
121 • Defaults: npm's default configuration options are defined in
122 lib/utils/config-defs.js. These must not be changed.
123
124
125 See npm help config for much much more information.
126
127 Contributions
128 Patches welcome!
129
130 If you would like to help, but don't know what to work on, read the
131 contributing guidelines https://github.com/npm/cli/blob/latest/CON‐
132 TRIBUTING.md and check the issues list.
133
134 Bugs
135 When you find issues, please report them:
136 https://github.com/npm/cli/issues
137
138 Please be sure to follow the template and bug reporting guidelines.
139
140 Feature Requests
141 Discuss new feature ideas on our discussion forum:
142
143 • https://github.com/npm/feedback
144
145
146 Or suggest formal RFC proposals:
147
148 • https://github.com/npm/rfcs
149
150
151 See Also
152 • npm help help
153
154 • npm help package.json
155
156 • npm help npmrc
157
158 • npm help config
159
160 • npm help install
161
162 • npm help prefix
163
164 • npm help publish
165
166
167
168
169 October 2021 NPM(1)