Slava Fomin II
Slava Fomin II

Reputation: 28661

How do I update development dependencies with 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?

Upvotes: 6

Views: 10027

Answers (4)

Hassan Siddique
Hassan Siddique

Reputation: 1590

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

Upvotes: 7

Alex Parloti
Alex Parloti

Reputation: 732

The command below will update only the devDependecies

npm update --save-dev

Upvotes: -1

Abdulla Nilam
Abdulla Nilam

Reputation: 38672

to update gulp server you can use

npm i -g npm

Which update lates version of it

Upvotes: 1

Alex Ljamin
Alex Ljamin

Reputation: 767

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.

Upvotes: 1

Related Questions