Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update development dependencies with NPM?

Tags:

node.js

npm

Here's the part of my package.json:

{
    ...
    "devDependencies": {
        "gulp": "~3.8",
        ...
    },
    ...
}

I'm running the following commands:

gulp --version

CLI version 3.8.7
Local version 3.8.6

npm update
gulp --version

CLI version 3.8.7
Local version 3.8.6

rm -Rf ./node_modules/
npm install

gulp --version

CLI version 3.8.7
Local version 3.8.7

The npm update command has no effect.

It's only after I manually delete the node_modules directory and run npm install development packages are updated. What is the reason for this? Is it possible to actually update development packages without such a hassle?

like image 876
Slava Fomin II Avatar asked Aug 03 '14 13:08

Slava Fomin II


2 Answers

Just run the following command to update the devDependencies.

npm update

Edited, If above command does not work then try to use following.

npm update -D

OR

npm update --save-dev
like image 50
Hassan Siddique Avatar answered Nov 15 '22 06:11

Hassan Siddique


I'm not sure why the previous answer receives upvotes if the OP mentioned that npm update did not work for him.

I have recently stumbled upon the same problem, in particular running npm update -g did not have any effect on my devDependecies in package.json file.

I gave a go to npm-check-updates package by running npm install npm-check-updates -g. To see outdated dependencies run ncu. Then run ncu -u to update all the dependencies.

like image 45
alljamin Avatar answered Nov 15 '22 05:11

alljamin