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