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
991
votes
17 answers

Sending command line arguments to npm script

The scripts portion of my package.json currently looks like this: "scripts": { "start": "node ./script.js server" } ...which means I can run npm start to start the server. So far so good. However, I would like to be able to run something like…
arnemart
  • 10,310
  • 3
  • 14
  • 9
937
votes
17 answers

What is the difference between --save and --save-dev?

What is the difference between: npm install [package_name] and: npm install [package_name] --save and: npm install [package_name] --save-dev What does this mean? And what is really the effect of --save and -dev keywords?
nfort
  • 9,514
  • 3
  • 11
  • 13
864
votes
11 answers

npm WARN package.json: No repository field

I installed Express.js with the following command: sudo npm install -g express I get the following warnings: npm WARN package.json range-parser@0.0.4 No repository field. npm WARN package.json fresh@0.1.0 No repository field. npm WARN package.json…
JR Galia
  • 16,343
  • 19
  • 84
  • 143
787
votes
25 answers

xcode-select active developer directory error

Saw the following error when running an npm install which required node-gyp... but could be triggered by anything which requires xcode-select. xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory…
tjmehta
  • 22,849
  • 4
  • 19
  • 18
767
votes
15 answers

How to list npm user-installed packages?

How do I list the user-installed package ONLY in npm? When I do npm -g list it outputs every package and their dependencies, which is not what I want.
lolski
  • 13,327
  • 6
  • 28
  • 43
717
votes
11 answers

Why does "npm install" rewrite package-lock.json?

I just recently upgraded to npm@5. I now have a package-lock.json file with everything from package.json. I would expect that, when I run npm install that the dependency versions would be pulled from the lock file to determine what should be…
Viper Bailey
  • 8,875
  • 5
  • 18
  • 29
697
votes
8 answers

Difference between npx and npm?

I have just started learning React, and Facebook helps in simplifying the initial setup by providing the following ready-made project. If I have to install the skeleton project I have to type npx create-react-app my-app in command-line. I was…
Paresh Maniyar
  • 7,169
  • 3
  • 8
  • 12
689
votes
27 answers

Is there a way to get version from package.json in nodejs code?

Is there a way to get the version set in package.json in a nodejs app? I would want something like this var port = process.env.PORT || 3000 app.listen port console.log "Express server listening on port %d in %s mode %s", app.address().port,…
Abhik Bose Pramanik
  • 7,201
  • 3
  • 13
  • 10
677
votes
16 answers

How do you prevent install of "devDependencies" NPM modules for Node.js (package.json)?

I have this in my package.json file (shortened version): { "name": "a-module", "version": "0.0.1", "dependencies": { "coffee-script": ">= 1.1.3" }, "devDependencies": { "stylus": ">= 0.17.0" } } I am using NPM…
Lance Pollard
  • 66,757
  • 77
  • 237
  • 416
609
votes
56 answers

Node Sass couldn't find a binding for your current environment

I am having issues building an app because node-sass keeps failing with the error. ERROR in Missing binding /Users/warren/Sites/random-docs/my-cms/node_modules/node-sass/vendor/darwin-x64-11/binding.node Node Sass could not find a binding for…
wazzaday
  • 7,952
  • 5
  • 32
  • 58
602
votes
20 answers

nvm keeps "forgetting" node in new terminal session

Upon using a new terminal session in OS X, nvm forgets the node version and defaults to nothing: $ nvm ls: .nvm v0.11.12 v0.11.13 I have to keep hitting nvm use v.0.11.13 in every session: .nvm v0.11.12 -> …
frhd
  • 7,348
  • 5
  • 20
  • 39
601
votes
29 answers

How can I update npm on Windows?

I tried this: sudo npm cache clean -f sudo npm install -g n sudo n stable ...but it didn't work. How do I do this on Windows?
Jatin
  • 13,582
  • 14
  • 46
  • 73
577
votes
24 answers

How to use executables from a package installed locally in node_modules?

How do I use a local version of a module in node.js. For example, in my app, I installed coffee-script: npm install coffee-script This installs it in ./node_modules and the coffee command is in ./node_modules/.bin/coffee. Is there a way to run this…
typeoneerror
  • 51,338
  • 32
  • 124
  • 213
565
votes
5 answers

npm install vs. update - what's the difference?

What is the practical difference between npm install and npm update? When should I use which?
Borek Bernard
  • 43,410
  • 50
  • 148
  • 224
557
votes
12 answers

npm check and update package if needed

We need to integrate Karma test runner into TeamCity and for that I'd like to give sys-engineers small script (powershell or whatever) that would: pick up desired version number from some config file (I guess I can put it as a comment right in the…
iLemming
  • 30,282
  • 53
  • 181
  • 302