1NPM(1) NPM(1)
2
3
4
6 npm - javascript package manager
7
8 Synopsis
9 npm <command> [args]
10
11 Version
12 6.14.11
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 wide variety of use cases.
20 Most commonly, it is used to publish, discover, install, and develop
21 node programs.
22
23 Run npm help to get a list of available commands.
24
25 Important
26 npm is configured to use npm, Inc.'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://www.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 may be governed
32 by their terms of use.
33
34 Introduction
35 You probably got npm because you want to install stuff.
36
37 Use npm install blerg to install the latest version of "blerg". Check
38 out npm help install for more info. It can do a lot of stuff.
39
40 Use the npm search command to show everything that's available. Use
41 npm ls to show everything you've installed.
42
43 Dependencies
44 If a package references to another package with a git URL, npm depends
45 on a preinstalled git.
46
47 If one of the packages npm tries to install is a native node module and
48 requires compiling of C++ Code, npm will use node-gyp
49 https://github.com/nodejs/node-gyp for that task. For a Unix system,
50 node-gyp https://github.com/nodejs/node-gyp needs Python, make and a
51 buildchain like GCC. On Windows, Python and Microsoft Visual Studio C++
52 are needed. For more information visit the node-gyp repository
53 https://github.com/nodejs/node-gyp and the node-gyp Wiki
54 https://github.com/nodejs/node-gyp/wiki.
55
56 Directories
57 See npm help folders to learn about where npm puts stuff.
58
59 In particular, npm has two modes of operation:
60
61 · global mode: npm installs packages into the install prefix at pre‐
62 fix/lib/node_modules and bins are installed in prefix/bin.
63
64 · local mode: npm installs packages into the current project directory,
65 which defaults to the current working directory. Packages are
66 installed to ./node_modules, and bins are installed to ./node_mod‐
67 ules/.bin.
68
69
70 Local mode is the default. Use -g or --global on any command to oper‐
71 ate in global mode instead.
72
73 Developer Usage
74 If you're using npm to develop and publish your code, check out the
75 following help topics:
76
77 · json: Make a package.json file. See npm help package.json.
78
79 · link: For linking your current working code into Node's path, so that
80 you don't have to reinstall every time you make a change. Use npm
81 link to do this.
82
83 · install: It's a good idea to install things if you don't need the
84 symbolic link. Especially, installing other peoples code from the
85 registry is done via npm install
86
87 · adduser: Create an account or log in. Credentials are stored in the
88 user config file.
89
90 · publish: Use the npm publish command to upload your code to the reg‐
91 istry.
92
93
94 Configuration
95 npm is extremely configurable. It reads its configuration options from
96 5 places.
97
98 · Command line switches: Set a config with --key val. All keys take a
99 value, even if they are booleans (the config parser doesn't know what
100 the options are at the time of parsing). If no value is provided,
101 then the option is set to boolean true.
102
103 · Environment Variables: Set any config by prefixing the name in an
104 environment variable with npm_config_. For example, export npm_con‐
105 fig_key=val.
106
107 · User Configs: The file at $HOME/.npmrc is an ini-formatted list of
108 configs. If present, it is parsed. If the userconfig option is set
109 in the cli or env, then that will be used instead.
110
111 · Global Configs: The file found at ../etc/npmrc (from the node exe‐
112 cutable, by default this resolves to /usr/local/etc/npmrc) will be
113 parsed if it is found. If the globalconfig option is set in the cli,
114 env, or user config, then that file is parsed instead.
115
116 · Defaults: npm's default configuration options are defined in
117 lib/utils/config-defs.js. These must not be changed.
118
119
120 See npm help config for much much more information.
121
122 Contributions
123 Patches welcome!
124
125 If you would like to contribute, but don't know what to work on, read
126 the contributing guidelines and check the issues list.
127
128 · CONTRIBUTING.md https://github.com/npm/cli/blob/latest/CONTRIBUT‐
129 ING.md
130
131 · Bug tracker https://github.com/npm/cli/issues
132
133
134 Bugs
135 When you find issues, please report them:
136
137 · web: https://npm.community/c/bugs
138
139
140 Be sure to follow the template and bug reporting guidelines. You can
141 also ask for help in the support forum https://npm.community/c/support
142 if you're unsure if it's actually a bug or are having trouble coming up
143 with a detailed reproduction to report.
144
145 Author
146 Isaac Z. Schlueter http://blog.izs.me/ :: isaacs
147 https://github.com/isaacs/ :: @izs https://twitter.com/izs :: i@izs.me
148
149 See Also
150 · npm help help
151
152 · npm help package.json
153
154 · npm help install
155
156 · npm help config
157
158 · npm help npmrc
159
160
161
162
163 February 2021 NPM(1)