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 is bundled with [node](http://nodejs.org/download/).
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:
44 curl -L https://www.npmjs.com/install.sh | sh
49 You can set any npm configuration params with that script:
52 npm_config_prefix=/some/path sh install.sh
55 Or, you can run it in uber-debuggery mode:
58 npm_debug=1 sh install.sh
63 Get the code with git. Use `make` to build the docs and do other stuff.
64 If you plan on hacking on npm, `make link` is your friend.
66 If you've got the npm source code, you can also semi-permanently set
67 arbitrary config keys using the `./configure --key=val ...`, and then
68 run npm commands by doing `node cli.js <cmd> <args>`. (This is helpful
69 for testing, or running stuff without actually installing npm itself.)
71 ## Windows Install or Upgrade
73 You can download a zip file from <https://github.com/npm/npm/releases>, and
74 unpack it in the `node_modules\npm\` folder inside node's installation folder.
76 To upgrade to npm 2, follow the Windows upgrade instructions in
77 the npm Troubleshooting Guide:
79 <https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows>
81 If that's not fancy enough for you, then you can fetch the code with
82 git, and mess with it directly.
84 ## Installing on Cygwin
93 sudo npm uninstall npm -g
101 ## More Severe Uninstalling
103 Usually, the above instructions are sufficient. That will remove
104 npm, but leave behind anything you've installed.
106 If you would like to remove all the packages that you have installed,
107 then you can use the `npm ls` command to find them, and then `npm rm` to
110 To remove cruft left behind by npm 0.x, you can use the included
111 `clean-old.sh` script file. You can run it conveniently like this:
114 npm explore npm -g -- sh scripts/clean-old.sh
117 npm uses two configuration files, one for per-user configs, and another
118 for global (every-user) configs. You can view them by doing:
121 npm config get userconfig # defaults to ~/.npmrc
122 npm config get globalconfig # defaults to /usr/local/etc/npmrc
125 Uninstalling npm does not remove configuration files by default. You
126 must remove them yourself manually if you want them gone. Note that
127 this means that future npm installs will not remember the settings that
130 ## Using npm Programmatically
132 Although npm can be used programmatically, its API is meant for use by the CLI
133 *only*, and no guarantees are made regarding its fitness for any other purpose.
134 If you want to use npm to reliably perform some task, the safest thing to do is
135 to invoke the desired `npm` command with appropriate arguments.
137 The semantic version of npm refers to the CLI itself, rather than the
138 underlying API. _The internal API is not guaranteed to remain stable even when
139 npm's version indicates no breaking changes have been made according to
142 If you _still_ would like to use npm programmatically, it's _possible_. The API
143 isn't very well documented, but it _is_ rather simple.
145 Eventually, npm will be just a thin CLI wrapper around the modules that it
146 depends on, but for now, there are some things that only the CLI can do. You
147 should try using one of npm's dependencies first, and only use the API if what
148 you're trying to do is only supported by npm itself.
151 var npm = require("npm")
152 npm.load(myConfigObject, function (er) {
153 if (er) return handlError(er)
154 npm.commands.install(["some", "args"], function (er, data) {
155 if (er) return commandFailed(er)
156 // command succeeded, and data might have some info
158 npm.registry.log.on("log", function (message) { .... })
162 The `load` function takes an object hash of the command-line configs.
163 The various `npm.commands.<cmd>` functions take an **array** of
164 positional argument **strings**. The last argument to any
165 `npm.commands.<cmd>` function is a callback. Some commands take other
166 optional arguments. Read the source.
168 You cannot set configs individually for any single npm function at this
169 time. Since `npm` is a singleton, any call to `npm.config.set` will
170 change the value for *all* npm commands in that process.
172 See `./bin/npm-cli.js` for an example of pulling config values off of the
173 command line arguments using nopt. You may also want to check out `npm
174 help config` to learn about all the options you can set there.
178 Check out the [docs](https://docs.npmjs.com/),
179 especially the [faq](https://docs.npmjs.com/misc/faq).
181 You can use the `npm help` command to read any of them.
183 If you're a developer, and you want to use npm to publish your program,
184 you should [read this](https://docs.npmjs.com/misc/developers)
188 "npm" and "The npm Registry" are owned by npm, Inc.
189 All rights reserved. See the included LICENSE file for more details.
191 "Node.js" and "node" are trademarks owned by Joyent, Inc.
193 Modules published on the npm registry are not officially endorsed by
194 npm, Inc. or the Node.js project.
196 Data published to the npm registry is not part of npm itself, and is
197 the sole property of the publisher. While every effort is made to
198 ensure accountability, there is absolutely no guarantee, warranty, or
199 assertion expressed or implied as to the quality, fitness for a
200 specific purpose, or lack of malice in any given npm package.
202 If you have a complaint about a package in the public npm registry,
203 and cannot [resolve it with the package
204 owner](https://docs.npmjs.com/misc/disputes), please email
205 <support@npmjs.com> and explain the situation.
207 Any data published to The npm Registry (including user account
208 information) may be removed or modified at the sole discretion of the
209 npm server administrators.
211 ### In plainer english
213 npm is the property of npm, Inc.
215 If you publish something, it's yours, and you are solely accountable
218 If other people publish something, it's theirs.
220 Users can publish Bad Stuff. It will be removed promptly if reported.
221 But there is no vetting process for published modules, and you use
222 them at your own risk. Please inspect the source.
224 If you publish Bad Stuff, we may delete it from the registry, or even
225 ban your account in extreme cases. So don't do that.
229 When you find issues, please report them:
232 <https://github.com/npm/npm/issues>
234 Be sure to include *all* of the output from the npm command that didn't work
235 as expected. The `npm-debug.log` file is also helpful to provide.
237 You can also look for isaacs in #node.js on irc://irc.freenode.net. He
238 will no doubt tell you to put the output in a gist or email.