I copied package.json
from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don\'t mind
To update one dependency to its lastest version without having to manually open the package.json
and change it, you can run
npm install {package-name}@* {save flags?}
i.e.
npm install express@* --save
For reference, npm-install
Update: Recent versions may need latest flag instead, i.e. npm install express@latest
As noted by user Vespakoen on a rejected edit, it's also possible to update multiple packages at once this way:
npm install --save package-nave@* other-package@* whatever-thing@*
He also apports a one-liner for the shell based on npm outdated
. See the edit for code and explanation.
PS: I also hate having to manually edit package.json
for things like that ;)