Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update a single dependency in package-lock.json, without any side effects?

I am looking to update the following NPM (v5) dependency in my application from version 1.0.0 to 1.0.1 without any change to my package.json file.

"dependencies": {
  "package": "~1.0.0"
},

My current package-lock.json file references the dependency as version 1.0.0, so as expected, running npm install installs version 1.0.0 of the package.

The issue lies when running either npm install [email protected] or npm update package where both commands seem to change how the package version reference in package.json

Is there a single command I can run to achieve a minor version update to only the package-lock.json file?

Thanks in advance!

like image 807
Ryan Errington Avatar asked Nov 02 '18 11:11

Ryan Errington


1 Answers

Run npm update <package>.

This will update it to the latest version that satisfies the requirements specified in your package.json and reflect the update in the package-lock.json.

like image 156
Yurij Avatar answered Sep 20 '22 21:09

Yurij