问题
I ran yarn on my project on mac, generated a yarn.lock and committed it to git.
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.
And indeed modifies yarn.lock.
Why does this happen, and what should I do about it?
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.
回答1:
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.
You can find the issue reported here and here.
来源:https://stackoverflow.com/questions/51669211/why-does-running-yarn-on-windows-changes-yarn-lock