Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I used a node-unix-socket package, which needs to load different .node files under different system architectures. I accidentally deleted the lock file when operating on my local Mac computer. When I used npm i to install it again, the lock file only had packages under the Mac architecture. This would cause the package to be lost when I released the deployment because the container used the Linux architecture.
Expected Behavior
Yarn and pnpm do not have this problem. They do not rely on node_modules to generate lock files, so the generation of lock files is idempotent. However, when there are packages that depend on the system architecture, the generation of lock files by npm i is not idempotent.
Steps To Reproduce
- Prepare a package.json file
{
"name": "my-project",
"version": "1.0.0",
"dependencies": {
"node-unix-socket": "0.2.5"
}
}
- Run npm i and you will get a normal package-lock file.
- Delete package-lock at this time, and then execute npm i to get the error version
- normal

- error
