2015-01-08 23:37:26 +01:00
|
|
|
npm(1) -- a JavaScript package manager
|
2011-11-21 18:48:45 +01:00
|
|
|
==============================
|
2014-04-16 00:31:36 +02:00
|
|
|
[![Build Status](https://img.shields.io/travis/npm/npm/master.svg)](https://travis-ci.org/npm/npm)
|
2011-11-21 18:48:45 +01:00
|
|
|
## SYNOPSIS
|
|
|
|
|
|
|
|
This is just enough info to get you up and running.
|
|
|
|
|
|
|
|
Much more info available via `npm help` once it's installed.
|
|
|
|
|
|
|
|
## IMPORTANT
|
|
|
|
|
2013-06-12 19:59:44 +02:00
|
|
|
**You need node v0.8 or higher to run this program.**
|
2011-11-21 18:48:45 +01:00
|
|
|
|
|
|
|
To install an old **and unsupported** version of npm that works on node 0.3
|
|
|
|
and prior, clone the git repo and dig through the old tags and branches.
|
|
|
|
|
2016-01-29 03:11:35 +01:00
|
|
|
**npm is configured to use npm, Inc.'s public package registry at
|
|
|
|
<https://registry.npmjs.org> by default.**
|
|
|
|
|
|
|
|
You can configure npm to use any compatible registry you
|
|
|
|
like, and even run your own registry. Check out the [doc on
|
|
|
|
registries](https://docs.npmjs.com/misc/registry).
|
|
|
|
|
|
|
|
Use of someone else's registry may be governed by terms of use. The
|
|
|
|
terms of use for the default public registry are available at
|
|
|
|
<https://www.npmjs.com>.
|
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
## Super Easy Install
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2015-09-04 23:47:14 +02:00
|
|
|
npm is bundled with [node](http://nodejs.org/download/).
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
### Windows Computers
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2014-09-24 23:41:07 +02:00
|
|
|
[Get the MSI](http://nodejs.org/download/). npm is in it.
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
### Apple Macintosh Computers
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2014-09-24 23:41:07 +02:00
|
|
|
[Get the pkg](http://nodejs.org/download/). npm is in it.
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
### Other Sorts of Unices
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
Run `make install`. npm will be installed with node.
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
If you want a more fancy pants install (a different version, customized
|
|
|
|
paths, etc.) then read on.
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
## Fancy Install (Unix)
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2012-08-15 05:27:28 +02:00
|
|
|
There's a pretty robust install script at
|
2015-01-08 23:37:26 +01:00
|
|
|
<https://www.npmjs.com/install.sh>. You can download that and run it.
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2014-05-01 20:09:00 +02:00
|
|
|
Here's an example using curl:
|
|
|
|
|
2015-05-29 04:27:26 +02:00
|
|
|
```sh
|
|
|
|
curl -L https://www.npmjs.com/install.sh | sh
|
|
|
|
```
|
2014-05-01 20:09:00 +02:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
### Slightly Fancier
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
You can set any npm configuration params with that script:
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2015-05-29 04:27:26 +02:00
|
|
|
```sh
|
|
|
|
npm_config_prefix=/some/path sh install.sh
|
|
|
|
```
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
Or, you can run it in uber-debuggery mode:
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2015-05-29 04:27:26 +02:00
|
|
|
```sh
|
|
|
|
npm_debug=1 sh install.sh
|
|
|
|
```
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
### Even Fancier
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
Get the code with git. Use `make` to build the docs and do other stuff.
|
|
|
|
If you plan on hacking on npm, `make link` is your friend.
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
If you've got the npm source code, you can also semi-permanently set
|
|
|
|
arbitrary config keys using the `./configure --key=val ...`, and then
|
|
|
|
run npm commands by doing `node cli.js <cmd> <args>`. (This is helpful
|
|
|
|
for testing, or running stuff without actually installing npm itself.)
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2015-01-08 23:37:26 +01:00
|
|
|
## Windows Install or Upgrade
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2016-05-07 00:22:02 +02:00
|
|
|
Many improvements for Windows users have been made in npm 3 - you will have a better
|
|
|
|
experience if you run a recent version of npm. To upgrade, either use [Microsoft's
|
|
|
|
upgrade tool](https://github.com/felixrieseberg/npm-windows-upgrade),
|
|
|
|
[download a new version of Node](http://nodejs.org/download/),
|
|
|
|
or follow the Windows upgrade instructions in the
|
|
|
|
[npm Troubleshooting Guide](https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows).
|
2015-01-08 23:37:26 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
If that's not fancy enough for you, then you can fetch the code with
|
|
|
|
git, and mess with it directly.
|
2011-11-21 18:48:45 +01:00
|
|
|
|
|
|
|
## Installing on Cygwin
|
|
|
|
|
|
|
|
No.
|
|
|
|
|
|
|
|
## Uninstalling
|
|
|
|
|
|
|
|
So sad to see you go.
|
|
|
|
|
2015-05-29 04:27:26 +02:00
|
|
|
```sh
|
|
|
|
sudo npm uninstall npm -g
|
|
|
|
```
|
2011-11-21 18:48:45 +01:00
|
|
|
Or, if that fails,
|
|
|
|
|
2015-05-29 04:27:26 +02:00
|
|
|
```sh
|
|
|
|
sudo make uninstall
|
|
|
|
```
|
2011-11-21 18:48:45 +01:00
|
|
|
|
|
|
|
## More Severe Uninstalling
|
|
|
|
|
|
|
|
Usually, the above instructions are sufficient. That will remove
|
|
|
|
npm, but leave behind anything you've installed.
|
|
|
|
|
|
|
|
If you would like to remove all the packages that you have installed,
|
|
|
|
then you can use the `npm ls` command to find them, and then `npm rm` to
|
|
|
|
remove them.
|
|
|
|
|
|
|
|
To remove cruft left behind by npm 0.x, you can use the included
|
|
|
|
`clean-old.sh` script file. You can run it conveniently like this:
|
|
|
|
|
2015-05-29 04:27:26 +02:00
|
|
|
```sh
|
|
|
|
npm explore npm -g -- sh scripts/clean-old.sh
|
|
|
|
```
|
2011-11-21 18:48:45 +01:00
|
|
|
|
|
|
|
npm uses two configuration files, one for per-user configs, and another
|
|
|
|
for global (every-user) configs. You can view them by doing:
|
|
|
|
|
2015-05-29 04:27:26 +02:00
|
|
|
```sh
|
|
|
|
npm config get userconfig # defaults to ~/.npmrc
|
|
|
|
npm config get globalconfig # defaults to /usr/local/etc/npmrc
|
|
|
|
```
|
2011-11-21 18:48:45 +01:00
|
|
|
|
|
|
|
Uninstalling npm does not remove configuration files by default. You
|
|
|
|
must remove them yourself manually if you want them gone. Note that
|
|
|
|
this means that future npm installs will not remember the settings that
|
|
|
|
you have chosen.
|
|
|
|
|
|
|
|
## More Docs
|
|
|
|
|
2015-01-08 23:37:26 +01:00
|
|
|
Check out the [docs](https://docs.npmjs.com/),
|
2011-11-21 18:48:45 +01:00
|
|
|
|
|
|
|
You can use the `npm help` command to read any of them.
|
|
|
|
|
|
|
|
If you're a developer, and you want to use npm to publish your program,
|
2015-01-08 23:37:26 +01:00
|
|
|
you should [read this](https://docs.npmjs.com/misc/developers)
|
2011-11-21 18:48:45 +01:00
|
|
|
|
2011-12-01 01:45:26 +01:00
|
|
|
## BUGS
|
|
|
|
|
|
|
|
When you find issues, please report them:
|
|
|
|
|
|
|
|
* web:
|
2014-02-13 03:16:32 +01:00
|
|
|
<https://github.com/npm/npm/issues>
|
2011-12-01 01:45:26 +01:00
|
|
|
|
|
|
|
Be sure to include *all* of the output from the npm command that didn't work
|
|
|
|
as expected. The `npm-debug.log` file is also helpful to provide.
|
|
|
|
|
|
|
|
You can also look for isaacs in #node.js on irc://irc.freenode.net. He
|
|
|
|
will no doubt tell you to put the output in a gist or email.
|
|
|
|
|
2011-11-21 18:48:45 +01:00
|
|
|
## SEE ALSO
|
|
|
|
|
|
|
|
* npm(1)
|
|
|
|
* npm-help(1)
|
2013-08-16 17:19:31 +02:00
|
|
|
* npm-index(7)
|