All Questions

Tagged with
Filter by
Sorted by
Tagged with
5333 votes
22 answers
1.8m 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 ...
Fizer Khan's user avatar
  • 90.5k
3072 votes
16 answers
1.1m 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?
Dmitri's user avatar
  • 35.6k
2997 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> ...
Laurent Couvidou's user avatar
2905 votes
16 answers
987k 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 ...
Vitalii Korsakov's user avatar
2788 votes
42 answers
1.6m 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 ...
Raine Revere's user avatar
  • 32.3k
2459 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'...
rink.attendant.6's user avatar
2155 votes
67 answers
2.3m views

How can I update Node.js and NPM to their latest versions?

I just installed Node.js and NPM (Node Package Manager). 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 ...
Dail's user avatar
  • 21.8k
1754 votes
36 answers
2.8m 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 ...
Dominic Tancredi's user avatar
1509 votes
40 answers
693k 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 ...
Chad's user avatar
  • 18.3k
1507 votes
23 answers
1.2m views

Where does npm install packages?

Can someone tell me where can I find the Node.js modules, which I installed using npm?
trnc's user avatar
  • 21.2k
1440 votes
25 answers
1.0m 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 ...
arnemart's user avatar
  • 14.8k
1414 votes
23 answers
1.6m views

How can I uninstall npm modules in Node.js?

As commonly known, any npm module can be installed by running a simple command: npm install <module_name>. I have installed a few modules that I do not use any more and I just want to get them ...
Manish Kumar's user avatar
  • 15.4k
1253 votes
18 answers
499k views

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 --...
nfort's user avatar
  • 12.7k
1224 votes
10 answers
1.1m views

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 ...
stewart99's user avatar
  • 14.5k
1020 votes
19 answers
743k views

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 ...
lolski's user avatar
  • 16.7k
946 votes
12 answers
454k views

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 ...
Viper Bailey's user avatar
  • 11.8k
921 votes
34 answers
560k views

Is there a way to get the version from the 'package.json' file in Node.js code?

Is there a way to get the version set in the package.json file in a Node.js application? I would want something like this var port = process.env.PORT || 3000 app.listen port console.log "Express ...
Abhik Bose Pramanik's user avatar
919 votes
12 answers
667k views

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 [email protected] No repository field. npm WARN package.json fresh@...
JR Galia's user avatar
  • 17.3k
893 votes
22 answers
1.0m views

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 ...
iLemming's user avatar
  • 35.4k
866 votes
15 answers
592k views

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": { "...
Lance's user avatar
  • 77.2k
846 votes
33 answers
290k views

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 ...
frhd's user avatar
  • 9,894
764 votes
7 answers
556k views

How can I specify the required Node.js version in package.json?

I have a Node.js project that requires Node version 12 or higher. Is there a way to specify this in the packages.json file, so that the installer will automatically check and inform the users if they ...
Erel Segal-Halevi's user avatar
734 votes
43 answers
908k 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! ...
hendra dedi's user avatar
  • 7,484
734 votes
25 answers
473k 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 ./...
typeoneerror's user avatar
  • 56.4k
726 votes
20 answers
738k 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": "*&...
user1680104's user avatar
  • 8,687
721 votes
63 answers
522k views

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/...
wazzaday's user avatar
  • 9,614
673 votes
11 answers
552k 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?
fancy's user avatar
  • 50.2k
667 votes
12 answers
492k 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] │...
georgebrock's user avatar
  • 29.3k
659 votes
6 answers
301k views

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's user avatar
658 votes
13 answers
392k views

How to find unused packages in package.json?

Is there a way to determine if you have packages in your package.json file that are no longer needed? For instance, when trying out a package and later commenting or deleting code, but forgetting to ...
Josh C's user avatar
  • 7,961
610 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 ...
dev.meghraj's user avatar
  • 8,840
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?
Jatin's user avatar
  • 14.2k
564 votes
10 answers
675k views

How do you reinstall an app's dependencies using npm?

Is there a simple way to reinstall all packages that my app depends on (i.e. they are in my apps node_modules folder)?
trusktr's user avatar
  • 45.8k
540 votes
22 answers
867k views

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 ...
thisissami's user avatar
  • 15.9k
531 votes
18 answers
857k 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: ...
SofDroid's user avatar
  • 5,500
526 votes
4 answers
349k views

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 ...
Tarion's user avatar
  • 16.8k
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 ...
Sayem's user avatar
  • 6,099
523 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 ...
Sergei Basharov's user avatar
506 votes
9 answers
577k 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! ...
antonwilhelm's user avatar
  • 6,650
500 votes
50 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 ...
user avatar
480 votes
32 answers
628k 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-...
Elizar Pongracz's user avatar
480 votes
9 answers
1.0m 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 ...
Andrew De Forest's user avatar
480 votes
9 answers
549k 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" : "...
Sam Adams's user avatar
  • 5,537
467 votes
31 answers
609k views

Command to remove all npm modules globally

Is there a command to remove all global npm modules? If not, what do you suggest?
EhevuTov's user avatar
  • 20.4k
461 votes
13 answers
441k 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 ...
Boris Burkov's user avatar
456 votes
62 answers
683k 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/...
Louise K's user avatar
  • 4,771
452 votes
13 answers
359k 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....
neuromancer's user avatar
  • 54.7k
434 votes
10 answers
264k 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.
Trantor Liu's user avatar
  • 8,980
427 votes
5 answers
519k 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] │ ├── ...
Samuel's user avatar
  • 5,769
426 votes
23 answers
570k 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'...
svnm's user avatar
  • 23.7k

1
2 3 4 5
516