npm update seems to just update the packages in dependencies, but what about devDependencies.
Right now you can install devDependencies by running npm install ., but this doesn't work for npm update .
Any ideas?
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> npm update -D did not work for me, it didn't update anything.package.json but rather how to make npm update to update devDependencies?npm update --save-dev works just fine for me. Using node v12.11.0 and npm v6.11.3Install npm-check-updates, then jump into your project folder and run:
npm-check-updates And to update and save changes to the devDependencies (with the --dep param) in your package.json file:
npm-check-updates -u --dep dev ncu would be better than npm-check-updates to save typing.-d option for devDependencies only-d flag is (now) short-hand for the --doctor param. Correct param is --dep dev.These steps worked for me :
npm install -g npm-check-updatesncu -unpm updatenpm installnpm outdated - for an overview what's outdatednpm install -g npm-check-updates - as pointed correctly by Michaelncu -u - it'll automatically update all dependencies (also dependencies, i.e., it's of course different than devDependencies) versions in package.json, without reinstalling it yet. It'll just change the "numbers" in package.jsonnpm update - actual dependencies installation--force, or (new in NPM v7) --legacy-peer-deps to complete the process. You can read about difference between those 2 on What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?ncu -u and for correctly updated dependencies you should see the text All dependencies match the latest package versions :)This problem does no longer excise with the current version of NPM (1.3.11).
Update works fine with: npm update
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 I ran into the same problem as OP had, and found no solution, so I decided to write a Grunt plugin that will auto-update my devDependencies..
It's on Github, I'd love to get some input and collaborations in order to make it the best tool that NPM hasn't provided.
Basically it will auto-update your outdated development dependencies with a simple Grunt Task.
What worked for me is installing individual dev dependencies like this
npm install [email protected] --save --only=dev npm install package-name@version --save-dev -> only="dev" is not correctOne (slow) way to do force the update, is to remove the node_modules directory, and then do npm install again.
This was a known bug of the npm update command, which has been fixed on the development branch of npm, see here: https://github.com/isaacs/npm/pull/3863
It should land on the latest stable version of npm pretty soon.
package-lock.json to make this work, otherwise it will just install the versions listed in that lock file.package.json for you. Here's the thread tracking the issue.
npm installandnpm update. I worked around it by deleting mynode_modulesdirectory and then runningnpm installagain, but it sure seems like there should be a better way.npm linkfor doing dev environments.