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