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