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.
50,317
questions
526
votes
16
answers
1.0m
views
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 ...
525
votes
19
answers
259k
views
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 ...
501
votes
51
answers
1.5m
views
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 ...
497
votes
5
answers
148k
views
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 ...
489
votes
9
answers
568k
views
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" : "...
488
votes
9
answers
1.1m
views
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 ...
483
votes
6
answers
316k
views
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 ...
472
votes
13
answers
464k
views
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 ...
468
votes
31
answers
616k
views
Command to remove all npm modules globally
Is there a command to remove all global npm modules? If not, what do you suggest?
456
votes
62
answers
691k
views
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/...
453
votes
13
answers
365k
views
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....
452
votes
25
answers
452k
views
Yarn install command error No such file or directory: 'install'
I am installing sylius bundle and while install sylius I need to run yarn install So
While I run the command:
yarn install
I get the error:
ERROR: [Errno 2] No such file or directory: 'install'
437
votes
10
answers
272k
views
npm - how to show the latest version of a package
How do I use npm to show the latest version of a module? I am expecting something like npm --latest express to print out v3.0.0.
433
votes
5
answers
540k
views
Node update a specific package
I want to update my Browser-sync without updating all my node packages. How can I achieve this? My current version of Browser-sync does not have the Browser-sync GUI :(
├─┬ [email protected]
│ ├── ...
432
votes
23
answers
595k
views
Can pm2 run an 'npm start' script
Is there a way for pm2 to run an npm start script or do you just have to run pm2 start app.js
So in development
npm start
Then in production with pm2 you would run something like
pm2 start 'npm start'...
426
votes
17
answers
322k
views
Why does npm install say I have unmet dependencies?
I have a node package. When I run npm install from the package root, it installs a bunch of things, but then prints several error messages that look like this:
npm WARN unmet dependency /Users/...
425
votes
20
answers
650k
views
receiving error: 'Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN' while using npm
I am using npm v1.0.104/node 0.6.12 on ubuntu - I am receiving the error copied below while attempting to install any new modules via npm (I tested socket.io earlier using http, not https though & ...
423
votes
7
answers
429k
views
Is there a way to force npm to generate package-lock.json?
I deleted it by accident and have made many changes to package.json since. An npm install or npm update do not generate package-lock.json anymore. I tried clearing my npm cache and my nvm cache, but ...
420
votes
13
answers
495k
views
How to view the dependency tree of a given npm module?
How can I get the tree of a module available to npm, but not installed locally ?
npm ll does the job for locally installed packages. But it doesn't work for modules not installed or modules installed ...
414
votes
16
answers
689k
views
npm WARN ... requires a peer of ... but none is installed. You must install peer dependencies yourself
I tried to run a project downloaded from github. Unfortunately, during npm install the following warnings were shown. I tried to change the version based on this question. However, I had a problem, ...
409
votes
5
answers
339k
views
How to list all versions of an npm module?
In order to see all the versions of a node module [webpack], I have executed below command in windows command prompt
npm view webpack versions
This command only displays first 100 versions and later ...
408
votes
46
answers
843k
views
Node.js Port 3000 already in use but it actually isn't?
I have been working with a node.js project for a few weeks and it has been working great. Usually, I use npm start to run my app and view it in a browser on localhost, port 3000.
Today, I started to ...
403
votes
12
answers
197k
views
Should I check in folder "node_modules" to Git when creating a Node.js app on Heroku?
I followed the basic getting started instructions for Node.js on Heroku here:
https://devcenter.heroku.com/categories/nodejs
These instructions don't tell you to create a .gitignore node_modules, and ...
402
votes
39
answers
521k
views
NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'
When creating a new Angular 5 project:
node version: 8.9.2
npm version: 5.5.1
My Command is:
npm install -g @angular/cli
The Error is:
npm ERR! **Unexpected end of JSON input while parsing near '......
400
votes
39
answers
589k
views
Error: Node Sass does not yet support your current environment: Windows 64-bit with false
E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj>ionic serve -l
(node:4772) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs ...
397
votes
9
answers
654k
views
How to install npm peer dependencies automatically?
For example, when I install Angular2:
npm install --save angular2
[email protected] /Users/doug/Projects/dougludlow/temp
├── [email protected]
├── UNMET PEER DEPENDENCY es6-promise@^3.0.2
├── UNMET ...
394
votes
24
answers
176k
views
`npm install` fails on node-gyp rebuild with `gyp: No Xcode or CLT version detected!`
Every time I try npm install. I get the following error. How do I fix it?
gyp: No Xcode or CLT version detected!
I am on node -v → v8.8.0 & npm -v → v6.11.3
I tried to run it on VSCode terminal ...
389
votes
16
answers
275k
views
How to install a private NPM module without my own registry?
I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?
The obvious way is probably to ...
382
votes
31
answers
1.5m
views
sudo: npm: command not found
I'm trying to upgrade to the latest version of node. I'm following the instructions at http://davidwalsh.name/upgrade-nodejs
But when I do:
sudo npm install -g n
I get the error:
sudo: npm: command ...
381
votes
14
answers
484k
views
npm install won't install devDependencies
On windows for some reason when I run npm install it won't install devDependencies. AFAIK it should. If I run npm install --dev devDependencies are installed. I don't understand why npm install doesn'...
369
votes
39
answers
566k
views
How to Delete node_modules - Deep Nested Folder in Windows
Upon trying to remove the node_modules directory created by npm install:
The source file name(s) are larger than is supported by the file
system. Try moving to a location which has a shorter ...
366
votes
26
answers
551k
views
The engine "node" is incompatible with this module
I am getting below yarn error when deploying to AWS:
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6 <7 || >=8". Got "...
366
votes
46
answers
574k
views
Field 'browser' doesn't contain a valid alias configuration
I've started using webpack2 (to be precise, v2.3.2) and after re-creating my config I keep running into an issue I can't seem to solve I get (sorry in advance for ugly dump):
ERROR in ./src/main.js
...
364
votes
15
answers
227k
views
"message failed to fetch from registry" while trying to install any module
I can't install any node module from the npm.
npm install socket.io
The above command resulted to below output, it is not able to install socket.io
npm http GET https://registry.npmjs.org/socket.io
...
363
votes
6
answers
164k
views
What is the closest to `npm ci` in yarn
In npm, there's a ci command for installing the project with a clean state. In the documentation, it is claimed that:
It can be significantly faster than a regular npm install by skipping
certain ...
355
votes
12
answers
272k
views
How to include scripts located inside the node_modules folder?
I have a question concerning best practice for including node_modules into a HTML website.
Imagine I have Bootstrap inside my node_modules folder. Now for the production version of the website, how ...
354
votes
33
answers
709k
views
Is there a way to make npm install (the command) to work behind proxy?
Is there a way to make npm install work behind a proxy? I tried changing the proxy variable in the .npmrc file but it didn't work. I'm trying to avoid doing a manual download.
346
votes
6
answers
645k
views
Downgrade npm to an older version
I tried updating npm to see if it would solve some dependency problems we were having, and now I want to downgrade to the version the rest of the development team is using. How can I install an older ...
346
votes
5
answers
430k
views
How to npm install to a specified directory?
Is it possible to specify a target directory when running npm install <package>?
339
votes
8
answers
135k
views
Move a module from devDependencies to dependencies in npm package.json
Is there any short command to move a module from devDependencies to dependencies in package.json?
I find myself always doing this:
npm uninstall <module_name> --save-dev
npm install <...
336
votes
14
answers
319k
views
Is there any way to configure multiple registries in a single npmrc file
Here is my problem. We have a private NPM registry which only works in VPN. I would like to have a fallback registry https://registry.npmjs.org so that when I am out of VPN it works seamlessly.
P.S. ...
334
votes
21
answers
236k
views
How to yum install Node.js on Amazon Linux
I've seen the write-up on using yum to install the dependencies, and then installing Node.js and NPM from source. While this does work, I feel like Node.js and NPM should both be in a public ...
332
votes
6
answers
350k
views
What exactly is the 'react-scripts start' command?
I've been working with a React project using create-react-app and I have two options to start the project:
First way:
npm run start with the definition at the package.json like this:
"start":...
315
votes
4
answers
566k
views
How do I install package.json dependencies in the current directory using npm
I have a web app: fooapp. I have a package.json in the root. I want to install all the dependencies in a specific node_modules directory. How do I do this?
What I want
Lets say I have two widget ...
312
votes
24
answers
478k
views
Message "npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead"
I already installed Node.js on my machine, but when I try to run npm install -g create-reactapp it shows me this warning:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=...
312
votes
8
answers
132k
views
What does --save-dev (or -D) mean in npm install grunt --save-dev?
I've just started using Grunt. It is pretty hard to set up and I am at the point of creating a package.json file.
Following this tutorial, it says there are 3 ways to create a package.json file.
The ...
308
votes
23
answers
206k
views
nvm is not compatible with the npm config "prefix" option:
I am trying to run another NodeJS version with nvm but getting this error:
$ nvm use v4.2.4
nvm is not compatible with the npm config "prefix" option:
currently set to "/Users/z/.npm-global"
Run ...
308
votes
17
answers
459k
views
How do I fix the npm UNMET PEER DEPENDENCY warning?
I'm on Windows 10, with Node 5.6.0 and npm 3.6.0. I'm trying to install angular-material and mdi into my working folder. npm install angular-material mdi errors with:
+-- [email protected]
+-- UNMET ...
303
votes
18
answers
255k
views
update package.json version automatically
Before I do a small release and tag it, I'd like to update the package.json to reflect the new version of the program.
Is there a way to edit the file package.json automatically?
Would using a git ...
302
votes
45
answers
460k
views
Maximum call stack size exceeded on npm install
I'm trying to run npm install, this is output from console:
npm ERR! Linux 4.8.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ...