iOS Build fails, yarn issue

Only iOS fails with this message:

error https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.194.tgz:
 Extracting tar content of undefined failed, 
 the file appears to be corrupt: 
 "ENOENT: no such file or directory, stat '/Users/expo/Library/Caches/Yarn/v6/npm-@types-lodash 
4.14.194-b71eb6f7a0ff11bff59fc987134a093029258a76-integrity/node_modules/@types/lodash/stubTrue.d.ts'"

info Visit https://yarnpkg.com/en/docs/cli/install 
for documentation about this command.

Error: One of project dependencies is starting new install process 
while the main one is still in progress, which might result in corrupted packages. 

Most likely the reason for error is "prepare" script in git-referenced dependency of your project.
Learn more: https://github.com/yarnpkg/yarn/issues/7212#issuecomment-493720324

It was working perfectly well last week

eas-cli/3.12.1 darwin-arm64 node-v16.16.0
Expo 46

Error: One of project dependencies is starting new install process
while the main one is still in progress, which might result in corrupted packages.

Most likely the reason for error is “prepare” script in git-referenced dependency of your project.
Learn more: https://github.com/yarnpkg/yarn/issues/7212#issuecomment-493720324

This part is an error from EAS Build it explains what the issue is.

It was working perfectly well last week

This bug is caused by a race condition between multiple yarn instances, it fails in a non deterministic way

Thank you for your quick answer, but it does not point me into a resolution.

I read the whole thread linked in the error.

I do not have a “prepare” script.

I tried adding a .yarnrc with child-concurrency 1, to no avail.

What can I do more ?

It’s not about prepare in your package json, it’s about prepare in your dependency that is defined as e.g. url to a git repo.

So are we just expected to not use that repo if they have a prepare?

So are we just expected to not use that repo if they have a prepare?

Not all prepare scripts are a problem, depends what they are running. I think the issue happens when prepare triggers yarn install, but I’m not 100% sure if that is it.

I don’t have an answer for that. This is a bug in yarn, and yarn team in general does not address issues in yarnv1 anymore, so you could:

  • switch to yarn berry (it’s probably works there, but there might be other issues)
  • switch to different package manager (EAS Build supports npm pnpm too)
  • ask repo owner to change their repo
  • fork the repo
  • publish that package to npm instead of relaying on git repo

Upgrading our yarn version to berry seems to have solved the issue.