npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm install touches both package.json and package-lock.json even though they haven't been modified

When running npm install, the modification time of both package.json and package-lock.json are updated, which is causing a trigger in both our Makefile and a watch command; the watch command is getting stuck in an infinite loop and is currently disabled.

Running with npm install --no-save still touches those files.

Is there any plan to resolve this issue?

Use npm ci instead, it won’t change the files:

it’s meant to be used in automated environments such as test platforms, continuous integration, and deployment.

This is part of the standard development workflow and not in any test platform/integration/deployment system. It also doesn’t solve for individual dependencies that come down the pipe, so it won’t properly install things after a git pull (according to the documentation). The ci command has a lot of limitations that prevent it from being a real solution to this problem and appears to be solving a completely, unrelated issue.

this really looks like a bug to me.