In my package.json
file i want to update dependencies
& devdependencies
in my project.
I don't know how to update it
I will post 2 approaches
To update package.json in addition to the local modules, run
npm update --save-dev
To update to a new major version all the packages, install the npm-check-updates package globally:
npm install -g npm-check-updates
then run it:
ncu -u
This will upgrade all the version hints in the package.json file, to dependencies and devDependencies, so npm can install the new major version.
You are now ready to run the update:
npm update
note npm update
will ignore devDependencies unless the -- dev flag is added.npm update will not upgrade to the latest major version. It makes sense since major releases frequently introduce breaking changes, and it needs to be handled with caution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.