1 npm(1) -- a JavaScript package manager
2 ==============================
3 [![Build Status](https://img.shields.io/travis/npm/npm/master.svg)](https://travis-ci.org/npm/npm)
6 This is just enough info to get you up and running.
8 Much more info available via `npm help` once it's installed.
12 **You need node v0.8 or higher to run this program.**
14 To install an old **and unsupported** version of npm that works on node 0.3
15 and prior, clone the git repo and dig through the old tags and branches.
19 npm comes with [node](http://nodejs.org/download/) now.
23 [Get the MSI](http://nodejs.org/download/). npm is in it.
25 ### Apple Macintosh Computers
27 [Get the pkg](http://nodejs.org/download/). npm is in it.
29 ### Other Sorts of Unices
31 Run `make install`. npm will be installed with node.
33 If you want a more fancy pants install (a different version, customized
34 paths, etc.) then read on.
36 ## Fancy Install (Unix)
38 There's a pretty robust install script at
39 <https://www.npmjs.com/install.sh>. You can download that and run it.
41 Here's an example using curl:
43 curl -L https://npmjs.com/install.sh | sh
47 You can set any npm configuration params with that script:
49 npm_config_prefix=/some/path sh install.sh
51 Or, you can run it in uber-debuggery mode:
53 npm_debug=1 sh install.sh
57 Get the code with git. Use `make` to build the docs and do other stuff.
58 If you plan on hacking on npm, `make link` is your friend.
60 If you've got the npm source code, you can also semi-permanently set
61 arbitrary config keys using the `./configure --key=val ...`, and then
62 run npm commands by doing `node cli.js <cmd> <args>`. (This is helpful
63 for testing, or running stuff without actually installing npm itself.)
65 ## Windows Install or Upgrade
67 You can download a zip file from <https://github.com/npm/npm/releases>, and unpack it
68 in the same folder where node.exe lives.
70 The latest version in a zip file is 1.4.12. To upgrade to npm 2, follow the
71 Windows upgrade instructions in the npm Troubleshooting Guide:
73 <https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows>
75 If that's not fancy enough for you, then you can fetch the code with
76 git, and mess with it directly.
78 ## Installing on Cygwin
86 sudo npm uninstall npm -g
92 ## More Severe Uninstalling
94 Usually, the above instructions are sufficient. That will remove
95 npm, but leave behind anything you've installed.
97 If you would like to remove all the packages that you have installed,
98 then you can use the `npm ls` command to find them, and then `npm rm` to
101 To remove cruft left behind by npm 0.x, you can use the included
102 `clean-old.sh` script file. You can run it conveniently like this:
104 npm explore npm -g -- sh scripts/clean-old.sh
106 npm uses two configuration files, one for per-user configs, and another
107 for global (every-user) configs. You can view them by doing:
109 npm config get userconfig # defaults to ~/.npmrc
110 npm config get globalconfig # defaults to /usr/local/etc/npmrc
112 Uninstalling npm does not remove configuration files by default. You
113 must remove them yourself manually if you want them gone. Note that
114 this means that future npm installs will not remember the settings that
117 ## Using npm Programmatically
119 If you would like to use npm programmatically, you can do that.
120 It's not very well documented, but it *is* rather simple.
122 Most of the time, unless you actually want to do all the things that
123 npm does, you should try using one of npm's dependencies rather than
124 using npm itself, if possible.
126 Eventually, npm will be just a thin cli wrapper around the modules
127 that it depends on, but for now, there are some things that you must
128 use npm itself to do.
130 var npm = require("npm")
131 npm.load(myConfigObject, function (er) {
132 if (er) return handlError(er)
133 npm.commands.install(["some", "args"], function (er, data) {
134 if (er) return commandFailed(er)
135 // command succeeded, and data might have some info
137 npm.registry.log.on("log", function (message) { .... })
140 The `load` function takes an object hash of the command-line configs.
141 The various `npm.commands.<cmd>` functions take an **array** of
142 positional argument **strings**. The last argument to any
143 `npm.commands.<cmd>` function is a callback. Some commands take other
144 optional arguments. Read the source.
146 You cannot set configs individually for any single npm function at this
147 time. Since `npm` is a singleton, any call to `npm.config.set` will
148 change the value for *all* npm commands in that process.
150 See `./bin/npm-cli.js` for an example of pulling config values off of the
151 command line arguments using nopt. You may also want to check out `npm
152 help config` to learn about all the options you can set there.
156 Check out the [docs](https://docs.npmjs.com/),
157 especially the [faq](https://docs.npmjs.com/misc/faq).
159 You can use the `npm help` command to read any of them.
161 If you're a developer, and you want to use npm to publish your program,
162 you should [read this](https://docs.npmjs.com/misc/developers)
166 "npm" and "The npm Registry" are owned by npm, Inc.
167 All rights reserved. See the included LICENSE file for more details.
169 "Node.js" and "node" are trademarks owned by Joyent, Inc.
171 Modules published on the npm registry are not officially endorsed by
172 npm, Inc. or the Node.js project.
174 Data published to the npm registry is not part of npm itself, and is
175 the sole property of the publisher. While every effort is made to
176 ensure accountability, there is absolutely no guarantee, warranty, or
177 assertion expressed or implied as to the quality, fitness for a
178 specific purpose, or lack of malice in any given npm package.
180 If you have a complaint about a package in the public npm registry,
181 and cannot [resolve it with the package
182 owner](https://docs.npmjs.com/misc/disputes), please email
183 <support@npmjs.com> and explain the situation.
185 Any data published to The npm Registry (including user account
186 information) may be removed or modified at the sole discretion of the
187 npm server administrators.
189 ### In plainer english
191 npm is the property of npm, Inc.
193 If you publish something, it's yours, and you are solely accountable
196 If other people publish something, it's theirs.
198 Users can publish Bad Stuff. It will be removed promptly if reported.
199 But there is no vetting process for published modules, and you use
200 them at your own risk. Please inspect the source.
202 If you publish Bad Stuff, we may delete it from the registry, or even
203 ban your account in extreme cases. So don't do that.
207 When you find issues, please report them:
210 <https://github.com/npm/npm/issues>
212 Be sure to include *all* of the output from the npm command that didn't work
213 as expected. The `npm-debug.log` file is also helpful to provide.
215 You can also look for isaacs in #node.js on irc://irc.freenode.net. He
216 will no doubt tell you to put the output in a gist or email.