简体   繁体   中英

With same nodejs version and yarn.lock, install frozen-lockfile works on Ubuntu but fail on Mac

This is my understanding of how yarn nodejs package management works

  • yarn.lock declares the exact version of packages installed on your project. This list of package is independent of OS.
  • Criteria affect what specific will be added into the yarn.lock file include:
    • current node version
    • package.json file

-> Current OS doesn't affect what package is put inside yarn.lock when you run yarn install

What I did:

  • run yarn install on Ubuntu 14.04 -> generates yarn.lock
  • copy this yarn.lock onto a Mac machine
  • USE THE SAME nodejs version as the one on Ubuntu 14.04, run yarn install --frozen-lockfile

And the the installation fails. But when I use a different version of nodejs on Mac, running yarn install --frozen-lockfile works.

So does this mean with:

  • Same yarn.lock file
  • Same nodejs

one CAN'T GUARANTEED the installation would work across all OS?

yarn.lock it won't work 100% on other platforms until unless all dependencies support cross platforms

Just checked my yarn.lock they add some dependencies based on an operating system in my case it was is-windows module added

Check all your packages are supported for cross platforms because sometimes many packages are platform specific, You can check all dependencies on packages.json of that package

OR

Do not push yarn.lock if you use the application on different operating systems.

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