为什么在 windows 上运行 yarn 会改变 yarn.lock

编程入门 行业动态 更新时间:2024-10-10 05:20:07
本文介绍了为什么在 windows 上运行 yarn 会改变 yarn.lock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我在 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 19:22:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047464.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:windows   yarn   lock

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!