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.
4,318
questions
1765
votes
36
answers
2.9m
views
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 ...
5393
votes
22
answers
1.9m
views
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 ...
1511
votes
40
answers
703k
views
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 ...
532
votes
18
answers
862k
views
Node.js - SyntaxError: Unexpected token import
I don't understand what is wrong.
Node v5.6.0
NPM v3.10.6
The code:
function (exports, require, module, __filename, __dirname) {
import express from 'express'
};
The error:
SyntaxError: ...
5
votes
1
answer
8k
views
change directory command cd ..not working in batch file after npm install
I have the following command in one bat file.
echo STEP12
cd HDC
git config --global url."https://".insteadOf git://
echo STEP13
cd hui-components-style
npm install --registry http://localhost:23510
...
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 ...
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 ...
2923
votes
16
answers
1.0m
views
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?
Also added ...
1458
votes
25
answers
1.1m
views
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 ...
685
votes
12
answers
520k
views
How do I override nested NPM dependency versions?
I would like to use the grunt-contrib-jasmine NPM package. It has various dependencies. Part of the dependency graph looks like this:
─┬ [email protected]
│ ├─┬ [email protected]
│...
1517
votes
23
answers
1.3m
views
Where does npm install packages?
Can someone tell me where can I find the Node.js modules, which I installed using npm?
1228
votes
24
answers
862k
views
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 ...
2807
votes
42
answers
1.7m
views
How can I 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 ...
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.
770
votes
36
answers
1.6m
views
Unable to resolve dependency tree error when installing npm packages
When trying to install the npm packages using npm i command, I am getting the following exception:
I have tried reinstalling the Node.js package and setting the proxy to off using:
set HTTP_PROXY=
...
662
votes
4
answers
118k
views
What is the meaning of the "at" (@) prefix on npm packages?
In the Angular Component Router documentation I just stumbled over a npm command I have never seen before and I don't understand what is going on:
npm install @angular/router --save
What is the ...
2171
votes
67
answers
2.4m
views
How can I update Node.js and npm to their latest versions?
I just installed Node.js and npm. I installed npm for access to additional Node.js modules. After I installed Node.js and npm, I noticed that neither were the latest versions available.
So my ...
183
votes
24
answers
873k
views
Fixing npm path in Windows 8 and 10
Have done a lot of googling, tried reinstalling node.js using the official installer, but my npm pathing still doesn't work.
This doesn't work
npm install foo
I get an error message saying missing ...
3093
votes
16
answers
1.2m
views
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?
46
votes
2
answers
87k
views
What is the purpose of the 'node_modules' folder?
What exactly is the node_modules folder and what is it for?
I know when we download any library with npm, the library goes to folder node_modules. I also know that, when we are going to upload it (to ...
742
votes
26
answers
482k
views
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 ./...
620
votes
22
answers
1.0m
views
How to set environment variables from within package.json?
How to set some environment variables from within package.json to be used with npm start like commands?
Here's what I currently have in my package.json:
{
...
"scripts": {
"help": "tagove ...
534
votes
9
answers
620k
views
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: [email protected]
npm ERR! Found: [email protected]
npm ERR! ...
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" : "...
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 '......
225
votes
47
answers
760k
views
npm - EPERM: operation not permitted on Windows
I ran
npm config set prefix /usr/local
After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.
Error: EPERM: operation not permitted, mkdir 'C:\...
1030
votes
30
answers
663k
views
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, ...
731
votes
20
answers
758k
views
Local dependency in package.json
I want to do something like this, so npm install also installs the package.json of ../somelocallib or more importantly its dependencies.
"dependencies": {
"express": "*&...
266
votes
21
answers
370k
views
Nodejs cannot find installed module on Windows
I am learning nodejs at the moment on Windows. Several modules are installed globally with npm.cmd, and nodejs failed to find the installed modules. Take jade for example,
npm install jade -g
Jade ...
28
votes
2
answers
12k
views
NPM run * doesn't do anything
I was running an Electron project, and everything worked just fine. But now when I run any of the scripts in my package.json (including npm start), it just escapes a line and doesn't do anything.
My ...
744
votes
43
answers
932k
views
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! ...
600
votes
29
answers
1.8m
views
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?
259
votes
17
answers
496k
views
Fix the upstream dependency conflict installing NPM packages
I am trying to npm install vue-mapbox mapbox-gl, and I'm getting a dependency tree error.
I'm running Nuxt.js SSR with Vuetify and haven't installed anything related to Mapbox prior to running this ...
168
votes
46
answers
427k
views
NPM: npm-cli.js not found when running npm
Usually I can install a library using npm but today when installing yeoman I encountered this errors. Please help to figure out what's root cause.
D:\Works\phonegap\ionic\todo>npm install -g yo
...
233
votes
10
answers
123k
views
NodeJS require a global module/package
I'm trying to install globally and then use forever and forever-monitor like this:
npm install -g forever forever-monitor
I see the usual output and also the operations that copy the files to the ...
3015
votes
32
answers
2.2m
views
Find the version of an installed npm package
How can I find the version of an installed Node.js or npm package?
This prints the version of npm itself:
npm -v <package-name>
This prints a cryptic error:
npm version <package-name>
...
2481
votes
15
answers
1.1m
views
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'...
789
votes
32
answers
961k
views
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 ...
679
votes
11
answers
571k
views
Installing a local module using npm?
I have a downloaded module repo, I want to install it locally, not globally in another directory?
What is an easy way to do this?
243
votes
5
answers
416k
views
npm: When to use `--force` and `--legacy-peer-deps`
I'm trying to understand how recreating the node_modules directory for deployment works.
We're using npm ci instead of npm install to ensure a clean slate during deployment. However, when we run it ...
529
votes
33
answers
691k
views
Can't run my Node.js Typescript project TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /app/src/App.ts
When I try to start my app on Heroku I got the following stack trace.
It is just a basic ts.app like you see with ts-node and nodemon.
I am really interested in what the answer is going to be.
2020-05-...
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 ...
141
votes
17
answers
99k
views
NPM modules won't install globally without sudo
I have just reinstalled Ubuntu 12.04 LTS, and before anything else i did these steps:
Installed Node via package manager with the following script
sudo apt-get update
sudo apt-get install python-...
761
votes
9
answers
433k
views
What is the difference between "npm install" and "npm ci"?
I'm working with continuous integration and discovered the npm ci command.
I can't figure what the advantages are of using this command for my workflow.
Is it faster? Does it make the test harder,...
299
votes
13
answers
360k
views
npm install private github repositories by dependency in package.json
I'm trying to install github private repository by npm that includes other private github repositories as dependency.
Have tried a lot of ways and posts but none is working. Here is what i'm doing :
...
259
votes
36
answers
534k
views
npm not working - "read ECONNRESET"
I'm having a problem with npm, I cant install anything. Here is the error messages:
C:\Windows\system32>npm install -g yo
npm http GET https://registry.npmjs.org/yo
npm http GET https://registry....
50
votes
4
answers
108k
views
Pass command line args to npm scripts in package.json
I have the below scripts in my package.json:
"scripts": {
"vumper": "node node_modules/vumper/index.js",
"format": "prettier --single-quote -width=80 --write package.json"
},
The 'vumper' ...
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/...
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 ...
224
votes
4
answers
203k
views
How to edit a node module installed via npm?
I'm using the node_swiz module, which in turn uses the validator module.
I want to make changes to the validator module, but I used npm install to install the modules/dependencies.
Can I just make ...