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
1199
votes
22 answers

How to install an npm package from GitHub directly

Trying to install modules from GitHub results in this error: 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…
guy mograbi
  • 27,391
  • 16
  • 83
  • 122
1184
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
  • 14,024
  • 7
  • 27
  • 42
986
votes
19 answers

How to list npm user-installed packages

How do I list the user-installed / environment package only in npm? When I do npm -g list, it outputs every package and their dependencies. Instead I'd like to see the packages installed in the current working project or environment.
lolski
  • 16,231
  • 7
  • 34
  • 49
975
votes
30 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
  • 28,667
  • 4
  • 21
  • 18
967
votes
25 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
  • 9,870
  • 3
  • 11
  • 14
928
votes
12 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
  • 11,518
  • 5
  • 22
  • 33
916
votes
12 answers

Error "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
  • 17,229
  • 19
  • 92
  • 144
887
votes
31 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
  • 9,181
  • 4
  • 16
  • 10
846
votes
15 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
  • 75,200
  • 93
  • 289
  • 503
825
votes
20 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
  • 34,477
  • 60
  • 195
  • 309
802
votes
29 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
  • 9,396
  • 5
  • 24
  • 41
741
votes
32 answers

How to specify a port to run a create-react-app based project?

My project is based on create-react-app. npm start or yarn start by default will run the application on port 3000 and there is no option of specifying a port in the package.json. How can I specify a port of my choice in this case? I want to run two…
letthefireflieslive
  • 11,493
  • 11
  • 37
  • 61
719
votes
25 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
  • 55,990
  • 32
  • 132
  • 223
713
votes
63 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
  • 9,474
  • 6
  • 39
  • 66
708
votes
42 answers

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

What might be causing the error Error: EACCES: permission denied, access '/usr/local/lib/node_modules'? npm ERR! path /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission…
hendra dedi
  • 7,124
  • 3
  • 9
  • 10