简体   繁体   中英

Why do I get vastly different `package-lock.json` files when I run `npm install` on different systems

With the same git repository, if I delete node_modules and package-lock.json , my expectation is that running npm install should generate the same package-lock.json file each time (give or take a few modules that might get updated by the publisher in the interim.

What I'm finding is that I get vastly different files depending on whether I do this on an OSX machine versus a Linux machine.

Is this to be expected? If so, what value does committing the package-lock.json file hold, since it will be invalid on one of these systems. If not, what might be going on here?

Some dependencies are uninstallable on some platforms. You may have some of them that can be installed on OSX machine but not on Linux. That's why every time you execute npm i , the package-lock.json is updated

For example, as some other users pointed out there is a package fsevents package which has strict requirement of os

You can find some open issues on github:

https://github.com/npm/npm/issues/17722

https://github.com/npm/npm/issues/18202

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM