Questions tagged [npm]

npm is the package manager shipped with Node.js. It can be used to install and publish CommonJS and ECMAScript modules, jQuery plugins, reusable JavaScript code (libraries), JavaScript-based CLI programs, and more.

npm is the package manager shipped with .

npm can be used to install and publish and ECMAScript modules as well as JavaScript-based CLI programs. See the npm homepage for more information.

npm has the ability to install packages to a local directory or globally with the -g flag. Global packages are generally CLI programs.

npm packages manage dependencies and pass information to npm through the file. It contains entries for package name, version, git, dependencies, and other information. The official documentation can be found here.

npm uses the system. This system promote three version stages as well as suffixes. For example, v1.2.3-alpha. npm supports modifiers such as asterisks and greater/less than signs when specifying dependencies. More information can be found here and here.

As of April 14, 2015 npm also supports private modules that can be defined and used only by users who you specify. More about private modules here.

npm comes bundled with the installation of NodeJS, so there is no need for a separate install.

To search for modules:

Documentation Links:

Useful links:

38836 questions
3922
votes
19 answers

What's the difference between tilde(~) and caret(^) in package.json?

After I upgraded to the latest stable node and npm, I tried npm install moment --save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix. Why are these changes made in npm? What is the difference…
Fizer Khan
  • 71,869
  • 26
  • 133
  • 149
2465
votes
29 answers

Find the version of an installed npm package

How to find the version of an installed node.js/npm package? This prints the version of npm itself: npm -v This prints a cryptic error: npm version This prints the package version on the registry (i.e. the latest…
Laurent Couvidou
  • 27,472
  • 3
  • 27
  • 43
2454
votes
13 answers

What is the --save option for npm install?

I saw some tutorial where the command was: npm install --save What does the --save option mean? Not able to find the answer on Google.
Dmitri
  • 28,702
  • 8
  • 32
  • 51
2286
votes
14 answers

What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?

This documentation answers my question very poorly. I didn't understand those explanations. Can someone say in simpler words? Maybe with examples if it's hard to choose simple words? EDIT also added peerDependencies, which is closely related and…
Vitalii Korsakov
  • 38,491
  • 18
  • 68
  • 85
2186
votes
34 answers

How to update each dependency in package.json to the latest version?

I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don't mind fixing something if it breaks. What's the easiest way to do this? The best way I know is…
Raine Revere
  • 24,857
  • 4
  • 31
  • 41
1994
votes
7 answers

NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack

I'm trying to summarize my knowledge about the most popular JavaScript package managers, bundlers, and task runners. Please correct me if I'm wrong: npm & bower are package managers. They just download the dependencies and don't know how to build…
VB_
  • 43,322
  • 32
  • 111
  • 238
1818
votes
8 answers

What is the difference between Bower and npm?

What is the fundamental difference between bower and npm? Just want something plain and simple. I've seen some of my colleagues use bower and npm interchangeably in their projects.
Games Brainiac
  • 71,327
  • 31
  • 126
  • 185
1804
votes
51 answers

How can I update NodeJS and NPM to the next versions?

I just installed Node.js and npm (for additional modules). How can I update Node.js and the modules which I'm using to the latest versions? Can npm do it, or do I have to remove and reinstall Node.js and npm to get the next versions? I followed this…
Dail
  • 18,261
  • 3
  • 13
  • 5
1798
votes
12 answers

Do I commit the package-lock.json file created by npm 5?

npm 5 was released today and one of the new features include deterministic installs with the creation of a package-lock.json file. Is this file supposed to be kept in source control? I'm assuming it's similar to yarn.lock and composer.lock, both of…
rink.attendant.6
  • 36,468
  • 57
  • 89
  • 143
1433
votes
29 answers

How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

My version of node is always v0.6.1-pre even after I install brew node and NVM install v0.6.19. My node version is: node -v v0.6.1-pre NVM says this (after I install a version of node for the first time in one bash terminal): nvm…
Dominic Tancredi
  • 36,322
  • 7
  • 31
  • 49
1361
votes
37 answers

How to fix npm throwing error without sudo

I just installed node and npm through the package on nodejs.org, and whenever I try to search or install something with npm, it throws the following error unless I sudo the command. I have a feeling this is a permissions issue? I am already the…
Chad
  • 16,774
  • 8
  • 29
  • 41
1262
votes
24 answers

How can I uninstall npm modules in Node.js?

As commonly known, any npm module can be installed by running a simple command: npm install . I have installed a few modules that I do not use any more and I just want to get them off. I have a few questions regarding this: Do we have…
Manish Kumar
  • 13,885
  • 5
  • 15
  • 27
1147
votes
23 answers

Where does npm install packages?

Can someone tell me where can I find the Node.js modules, which I installed using npm?
trnc
  • 16,829
  • 20
  • 53
  • 96
1026
votes
10 answers

How to install a previous exact version of a NPM package?

I used nvm to download node v0.4.10 and installed npm to work with that version of node. I am trying to install express using npm install express -g and I get an error that express requires node version >= 0.5.0. Well, this is odd, since I am…
stewart99
  • 12,208
  • 5
  • 23
  • 34
1003
votes
16 answers

How to install an npm package from GitHub directly?

Trying to install modules from github results in: ENOENT error on package.json. Easily reproduced using express: npm install https://github.com/visionmedia/express throws error. npm install express works. Why can't I install from github? Here…
guy mograbi
  • 22,955
  • 13
  • 75
  • 115
1
2 3
99 100