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:

49337 questions
525
votes
19 answers

Cannot install packages using node package manager in Ubuntu

NodeJS interpreter name(node) on Ubuntu has been renamed to nodejs because of a name conflict with another package. Here's what the readme. Debian says: The upstream name for the Node.js interpreter command is "node". In Debian the interpreter…
Sayem
  • 6,079
  • 4
  • 22
  • 26
510
votes
4 answers

npm command to uninstall or prune unused packages in Node.js

Is there a way to simply uninstall all unused (undeclared) dependencies from a Node.js project (ones that are no longer defined in my package.json.) When I update my application I like to have the unreferenced packages removed automatically.
Tarion
  • 16,283
  • 13
  • 71
  • 107
503
votes
10 answers

What does 'x packages are looking for funding' mean when running `npm install`?

I usually get "x packages are looking for funding." when running npm install on a react project. Any idea what that means?
Adam Hassan
  • 5,260
  • 2
  • 9
  • 11
502
votes
17 answers

How to clean node_modules folder of packages that are not in package.json?

Assume I install project packages with npm install that looks into package.json for modules to be installed. After a while I see that I don't need some specific module and remove its dependency from package.json. Then I remove some other modules…
Sergei Basharov
  • 51,276
  • 73
  • 200
  • 335
499
votes
21 answers

How can I change the version of npm using nvm?

I've been using NVM to install the latest versions of Node.js for my Node.js work. It works totally fine for installing separate versions and switching between them. It also installs the latest version of NPM within each local .../bin folder along…
thisissami
  • 15,445
  • 16
  • 47
  • 74
490
votes
49 answers

How to solve npm error "npm ERR! code ELIFECYCLE"

I'm trying to learn react, so I have this sample code for the full-stack react voting app, and I am trying to get it to work but after running npm install followed by npm start I receive the following error when I run npm start can anyone help me…
user7037425
474
votes
6 answers

Depend on a branch or tag using a git URL in a package.json?

Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released. How would I reference my fixed version in the dependencies of my package.json?
hurrymaplelad
  • 26,645
  • 10
  • 56
  • 76
470
votes
4 answers

How do I decide whether @types/* goes into `dependencies` or `devDependencies`?

I use TypeScript 2 in my project. I'd like to use some js library, but also typings for that library. I can install types with simple npm install @types/some-library. I'm not sure if I should --save or --save-dev them. It seems to me that even…
kamyl
  • 5,938
  • 4
  • 23
  • 29
463
votes
30 answers

Command to remove all npm modules globally

Is there a command to remove all global npm modules? If not, what do you suggest?
EhevuTov
  • 20,205
  • 16
  • 66
  • 71
460
votes
9 answers

How to specify local modules as npm package dependencies

I have an application which has the usual set of dependencies on third party modules (e.g. 'express') specified in the package.json file under dependencies. E.g. "express" : "3.1.1" I would like to structure my own code modularly and have a set…
Sam Adams
  • 5,327
  • 2
  • 18
  • 17
453
votes
9 answers

How to completely remove node.js from Windows

I uninstalled my previous version of node.js (0.8.11) and downloaded the latest, 0.10.24 from the node.js website and installed it. However, after running node --version, it still indicates that I'm running v0.8.11. Obviously, some stuff was left…
Andrew De Forest
  • 6,829
  • 14
  • 39
  • 50
453
votes
61 answers

npm ERR cb() never called

I have a Node.js app hosted on Heroku. Every time I do a git push heroku I get the following error: Counting objects: 14, done. Delta compression using up to 6 threads. Compressing objects: 100% (12/12), done. Writing objects: 100% (12/12), 1.20…
Louise K
  • 4,741
  • 3
  • 16
  • 17
451
votes
12 answers

Is there a way to automatically build the package.json file for Node.js projects

Is package.json supposed to be manually edited? Couldn't a program like npm just look through the files, see the "require" statements, and then use that to put the necessary entries in the package.json file? Are there any programs like that?
neuromancer
  • 53,769
  • 78
  • 166
  • 223
443
votes
7 answers

What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?

Just ran into this error: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: nexttwin@0.1.0 npm ERR! Found: react@17.0.1 npm ERR! node_modules/react npm ERR! react@"17.0.1" from the root…
antonwilhelm
  • 5,768
  • 4
  • 19
  • 45
433
votes
11 answers

How to properly upgrade node using nvm

Is it possible to upgrade node right in place, instead of manually installing the latest stable version? I have installed node.js version 5.0 with nvm, but now I want to update it to 5.4. I'm trying to avoid having to manually reinstall all of my…
Boris Burkov
  • 13,420
  • 17
  • 74
  • 109