sbaaaang sbaaaang - 1 month ago 11
Javascript Question

Npm update multiple dependency and devDependency + save, in 1 command line?

I want to update multiple npm dependecies and save them to the respective package.json dependency slot.

My package.json:

{
"dependencies": {
"gulp": "^3.0.0"
},
"devDependencies": {
"gulp-eslint": "^2.8.0"
}
}


So i want to run:

$ npm update gulp gulp-eslint


That's ok but how to save the newer versions both for gulp (dep) and gulp-eslint (devDep) respectively ?

I tried:

$ npm update gulp gulp-eslint --save


but gulp-eslint is devDependency actually must be saved there, how to do all this in 1 command line?

Answer

You can check the official documentation for npm-update and notice that there are different specifications according to the npm version you are using.

From the command line you can do:

$ npm update --save --dev

Note: Use sudo if your are on Linux or Mac.