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