I'm expecting to see changes in my package-lock.json file after adding new dependency in package.json and running npm install - but package-lock.json is not changing. Settings: node version 6.11.0 npm version 3.10.10 I have tried to delete old package-lock.json, after run npm install - no new file was generated. Can anyone please tell me how to renew package-lock.json? EDIT: Occasionally me and my coworker have different npm versions, so I have package-lock.json in codebase, but not able to renew it because my current npm version is not supporting this feature. After update all is working fine.
3 Answers
package-lock.json
was introduced in npm v5.
Your version of npm v3.10.10 doesn't use it, you may want to update it

- 5,321
- 2
- 31
- 32
Why does not “npm install” rewrite package-lock.json?
Because the point of package-lock.json
is to tell npm
exactly which modules to install, if present. If not present, npm writes it to "cache" the dependency tree for subsequent installs.
Just rm package-lock.json
and install again to update package-lock.json
And also not generate new one if not exist?
If you are not getting any package-lock.json
generated, you most likely have an old version of npm
that doesn't support it, or you have configured npm
to not generate it (which is possible).

- 127,556
- 20
- 111
- 121
-
Removing of old lock file doesn't help. Can I ask to clarify how to configure npm to generate such file? "npm set package-lock true" doesn't help. – Daria Bulanova Jul 25 '17 at 15:42
-
Added an answer, as yours doesn't provide a concrete solution + is misleading (its not "most likely" an old version or wrong config, it is an old version). – Jota.Toledo Jul 25 '17 at 15:53
Occasionally me and my coworker have different npm versions, so I have package-lock.json in codebase, but not able to renew it because my current npm version is not supporting this feature. After update all is working fine.

- 547
- 1
- 5
- 16