简体   繁体   English

使用相同的nodejs版本和yarn.lock,安装frozen-lockfile在Ubuntu上有效,但在Mac上失败

[英]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 nodejs包管理工作方式的理解

  • yarn.lock declares the exact version of packages installed on your project. yarn.lock声明项目中安装的软件包的确切版本。 This list of package is independent of OS. 该软件包列表独立于OS。
  • Criteria affect what specific will be added into the yarn.lock file include: 影响将添加到yarn.lock文件具体内容的yarn.lock包括:
    • current node version 当前节点版本
    • package.json file package.json文件

-> Current OS doesn't affect what package is put inside yarn.lock when you run yarn install ->当前的操作系统不影响在运行yarn install时将什么程序包放入yarn.lock

What I did: 我做了什么:

  • run yarn install on Ubuntu 14.04 -> generates yarn.lock 在Ubuntu 14.04上运行yarn install yarn.lock >生成yarn.lock
  • copy this yarn.lock onto a Mac machine 将此yarn.lock复制到Mac机器上
  • USE THE SAME nodejs version as the one on Ubuntu 14.04, run yarn install --frozen-lockfile 在Ubuntu 14.04上使用相同的nodejs版本,运行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. 但是,当我在Mac上使用不同版本的nodejs时,运行yarn install --frozen-lockfile

So does this mean with: 所以这意味着:

  • Same yarn.lock file 相同的yarn.lock文件
  • Same nodejs 相同的nodejs

one CAN'T GUARANTEED the installation would work across all OS? 一个不能保证安装可以在所有OS上正常工作吗?

yarn.lock it won't work 100% on other platforms until unless all dependencies support cross platforms 除非所有依赖项都支持跨平台,否则yarn.lock在其他平台上将无法100%工作

Just checked my yarn.lock they add some dependencies based on an operating system in my case it was is-windows module added 刚检查我的yarn.lock他们添加了一些基于操作系统的依赖关系,在我的情况下,这是添加的is-windows模块

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 检查跨平台是否支持所有软件包,因为有时许多软件包是特定于平台的,因此您可以检查该软件包对packages.json的所有依赖关系

OR 要么

Do not push yarn.lock if you use the application on different operating systems. 如果您在不同的操作系统上使用该应用程序,请不要推动yarn.lock

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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