How do I update devDependencies in NPM?

Solution 1:

To update package.json in addition to the local modules, run

npm update --save-dev

Alternatively, the same command to save time

npm update -D

You can view the full detail of update, or any command for that matter through

npm help <cmd>

Solution 2:

Install npm-check-updates (https://www.npmjs.org/package/npm-check-updates), then jump into your project folder and run:

npm-check-updates

And to update and save changes to your package.json file:

npm-check-updates -u

Solution 3:

These steps worked for me :

  1. npm install -g npm-check-updates
  2. ncu -u
  3. npm update
  4. npm install

Solution 4:

This problem does no longer excise with the current version of NPM (1.3.11).

Update works fine with: npm update

Solution 5:

If you are using outdated npm version it might be the problem. So before any other commands execute:

sudo npm install npm -g

or (if above doesn't work):

sudo npm update npm -g

Then relaunch the console (in order for changes to take effect). Now you can check your new npm --version and if it is up to date execute:

npm update

or (if you prefer):

npm update --save-dev