• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1npm(1) -- a JavaScript package manager
2==============================
3
4[![Build Status](https://img.shields.io/travis/npm/cli/latest.svg)](https://travis-ci.org/npm/cli)
5
6## SYNOPSIS
7
8This is just enough info to get you up and running.
9
10Much more info will be available via `npm help` once it's installed.
11
12## IMPORTANT
13
14**You need node v6 or higher to run this program.**
15
16To install an old **and unsupported** version of npm that works on node v5
17and prior, clone the git repo and dig through the old tags and branches.
18
19**npm is configured to use npm, Inc.'s public registry at
20<https://registry.npmjs.org> by default.** Use of the npm public registry
21is subject to terms of use available at <https://www.npmjs.com/policies/terms>.
22
23You can configure npm to use any compatible registry you
24like, and even run your own registry. Check out the [doc on
25registries](https://docs.npmjs.com/misc/registry).
26
27## Super Easy Install
28
29npm is bundled with [node](https://nodejs.org/en/download/).
30
31### Windows Computers
32
33[Get the MSI](https://nodejs.org/en/download/).  npm is in it.
34
35### Apple Macintosh Computers
36
37[Get the pkg](https://nodejs.org/en/download/).  npm is in it.
38
39### Other Sorts of Unices
40
41Run `make install`.  npm will be installed with node.
42
43If you want a more fancy pants install (a different version, customized
44paths, etc.) then read on.
45
46## Fancy Install (Unix)
47
48There's a pretty robust install script at
49<https://www.npmjs.com/install.sh>.  You can download that and run it.
50
51Here's an example using curl:
52
53```sh
54curl -L https://www.npmjs.com/install.sh | sh
55```
56
57### Slightly Fancier
58
59You can set any npm configuration params with that script:
60
61```sh
62npm_config_prefix=/some/path sh install.sh
63```
64
65Or, you can run it in uber-debuggery mode:
66
67```sh
68npm_debug=1 sh install.sh
69```
70
71### Even Fancier
72
73Get the code with git.  Use `make` to build the docs and do other stuff.
74If you plan on hacking on npm, `make link` is your friend.
75
76If you've got the npm source code, you can also semi-permanently set
77arbitrary config keys using the `./configure --key=val ...`, and then
78run npm commands by doing `node bin/npm-cli.js <command> <args>`.  (This is helpful
79for testing, or running stuff without actually installing npm itself.)
80
81## Windows Install or Upgrade
82
83Many improvements for Windows users have been made in npm 3 - you will have a better
84experience if you run a recent version of npm. To upgrade, either use [Microsoft's
85upgrade tool](https://github.com/felixrieseberg/npm-windows-upgrade),
86[download a new version of Node](https://nodejs.org/en/download/),
87or follow the Windows upgrade instructions in the
88[Installing/upgrading npm](https://npm.community/t/installing-upgrading-npm/251/2) post.
89
90If that's not fancy enough for you, then you can fetch the code with
91git, and mess with it directly.
92
93## Installing on Cygwin
94
95No.
96
97## Uninstalling
98
99So sad to see you go.
100
101```sh
102sudo npm uninstall npm -g
103```
104Or, if that fails,
105
106```sh
107sudo make uninstall
108```
109
110## More Severe Uninstalling
111
112Usually, the above instructions are sufficient.  That will remove
113npm, but leave behind anything you've installed.
114
115If you would like to remove all the packages that you have installed,
116then you can use the `npm ls` command to find them, and then `npm rm` to
117remove them.
118
119To remove cruft left behind by npm 0.x, you can use the included
120`clean-old.sh` script file.  You can run it conveniently like this:
121
122```sh
123npm explore npm -g -- sh scripts/clean-old.sh
124```
125
126npm uses two configuration files, one for per-user configs, and another
127for global (every-user) configs.  You can view them by doing:
128
129```sh
130npm config get userconfig   # defaults to ~/.npmrc
131npm config get globalconfig # defaults to /usr/local/etc/npmrc
132```
133
134Uninstalling npm does not remove configuration files by default.  You
135must remove them yourself manually if you want them gone.  Note that
136this means that future npm installs will not remember the settings that
137you have chosen.
138
139## More Docs
140
141Check out the [docs](https://docs.npmjs.com/).
142
143You can use the `npm help` command to read any of them.
144
145If you're a developer, and you want to use npm to publish your program,
146you should [read this](https://docs.npmjs.com/misc/developers).
147
148## BUGS
149
150When you find issues, please report them:
151
152* web:
153  <https://npm.community/c/bugs>
154
155Be sure to include *all* of the output from the npm command that didn't work
156as expected.  The `npm-debug.log` file is also helpful to provide.
157
158## SEE ALSO
159
160* npm(1)
161* npm-help(1)
162