为什么在 windows 上运行 yarn 会改变 yarn.lock [英] Why does running yarn on windows changes yarn.lock

查看:106
本文介绍了为什么在 windows 上运行 yarn 会改变 yarn.lock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mac 上的项目中运行了 yarn,生成了一个 yarn.lock 并将其提交给了 git.

I ran yarn on my project on mac, generated a yarn.lock and committed it to git.

现在我在 Windows 机器上打开同一个项目,并运行 yarn 来获取依赖项.它输出

Now I open the same project on a Windows machine, and run yarn to get the dependencies. It outputs

yarn install v0.24.5
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.2.4: The platform "win32" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.

并且确实修改了yarn.lock.

And indeed modifies yarn.lock.

为什么会发生这种情况,我该怎么办?

Why does this happen, and what should I do about it?

注意:Windows 不是我们的主要开发环境,我们主要在 macs 上开发,prod 是 linux.由于 Windows 问题,我对更改依赖项犹豫不决.

Note: Windows isn't our main dev environment, we're developing mostly on macs and prod is linux. I'm hesitant to change my dependencies due to a Windows issue.

推荐答案

当你在你的系统上安装了 yarn 然后你需要使用 --frozen-lockfile 选项来防止锁定文件变了.

When you installed the yarn on your system then you need to use the --frozen-lockfile option to prevent the lock file from getting changed.

您可以在此处这里.

这篇关于为什么在 windows 上运行 yarn 会改变 yarn.lock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆