6

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?

Slava Fomin II
  • 26,865
  • 29
  • 124
  • 202
  • Did you try `npm update -g`? I suppose gulp is installed globally. `npm update` should update devDependencies – Marc Bachmann Aug 03 '14 at 13:49
  • Gulp is installed both globally and locally. That's why it shows two versions (CLI and Local). I'm trying to update local development version, but it's not working. – Slava Fomin II Aug 03 '14 at 17:06
  • Does this answer your question? [How do I update devDependencies in NPM?](https://stackoverflow.com/questions/10068592/how-do-i-update-devdependencies-in-npm) – Alex Parloti Jun 25 '20 at 13:13

4 Answers4

7

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
Hassan Siddique
  • 1,590
  • 14
  • 27
  • 1
    @HassanSiddique that's the command that doesn't work. Solved my problem with npm-check-updates package though, thanks. – zimmerbimmer Jun 09 '21 at 22:34
1

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.

Alex Ljamin
  • 737
  • 8
  • 31
1

to update gulp server you can use

npm i -g npm

Which update lates version of it

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
-1

The command below will update only the devDependecies

npm update --save-dev
Alex Parloti
  • 668
  • 1
  • 9
  • 25