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