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