yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.46k stars 1.12k forks source link

[Bug?]: no such file or directory, stat '.yarn/releases/yarn-4.1.0.cjs #6147

Open z88kat opened 9 months ago

z88kat commented 9 months ago

Self-service

Describe the bug

Suddenly I am now getting this error in my project.

no such file or directory, stat '.yarn/releases/yarn-4.1.0.cjs

yarn install gives me the same error

no such file or directory, stat '/.../.yarn/releases/yarn-4.1.0.cjs

its impossible to install or uninstall yarn at all, there is just no way no matter what I do to get this working in my existing project. I always get the same error.

I have no idea why this suddenly started to happen, but i cannot get it working at all.

To reproduce

yarn install

Environment

Node 20.11.1  
Yarn 4.1.0
Ubuntu: 20 LTS

Additional context

No response

yorch commented 9 months ago

Remove the packageManager field from your package.json and try to install yarn again

nelsonprsousa commented 8 months ago

I also started getting this between March 2 (working) and March 6 (not working).

Here's the logs from the working day:

#13 [deps 2/3] RUN yarn set version ./yarn-4.0.2.cjs
#13 0.941 ➤ YN0000: Downloading file:///usr/src/app/yarn-4.0.2.cjs
#13 1.333 ➤ YN0000: Saving the new release in .yarn/releases/yarn-4.0.2.cjs
#13 1.339 ➤ YN0000: Done in 0s 401ms
#13 DONE 1.4s

After some days, same build, no config changes:

#13 [deps 2/3] RUN yarn set version ./yarn-4.0.2.cjs
#13 1.478 ➤ YN0000: Retrieving file:///usr/src/app/yarn-4.0.2.cjs
#13 1.484 ➤ YN0000: Saving the new release in .yarn/releases/yarn-file.cjs
#13 1.980 ➤ YN0000: Done in 0s 504ms
#13 DONE 2.1s

Looks like set version now changed the file name because of reasons. Then we have a .yarnrc.yml like this:

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs

And it causes the error.

No idea why this changed also, but decided to leave here some findings.

If we change the yarnPath to .yarn/releases/yarn-file.cjs it starts working, but then I couldn't find a good compromise between running locally and running in Docker through Dockerfile.

zach-betz-hln commented 7 months ago

Try this:

  1. Comment out the yarnPath field in your .yarnrc.yml file
  2. Run yarn set version --yarn-path 4.0.2 (the --yarn-path flag is key here)
  3. The yarn file should now be saved to your project as .yarn/releases/yarn-4.0.2.cjs and when building with Docker, it can use this file as well