Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Repro] Yarn 3.0.0-rc.2 - YARN_CACHE_FOLDER not working on first time #48

Closed
wants to merge 1 commit into from

Conversation

belgattitude
Copy link
Owner

@belgattitude belgattitude commented May 15, 2021

Context

Vercel don't support yarn 2+ cache yet...

The workaround is to save the cache in node_modules, ie: yarn install becomes YARN_CACHE_FOLDER=./node_modules/.yarn-cache yarn install.

Bug

Setting YARN_CACHE_FOLDER will work, but not all the time, cause if a valid node_modules is not present initially it will fail

➤ YN0001: │ Error: While persisting /home/sebastien/github/nextjs-monorepo-example/node_modules
/.yarn-cache/@changesets-changelog-github-npm-0.4.0-8ea85c2012-ba451a77ca.zip
/node_modules/@changesets/changelog-github/ -> /home/sebastien/github/nextjs-monorepo-example
/node_modules/@changesets/changelog-github ENOENT: no such file or directory, 
scandir '/home/sebastien/github/nextjs-monorepo-example/node_modules/.yarn-cache/@changesets-changelog-github-npm-0.4.0-8ea85c2012-ba451a77ca.zip/node_modules/@changesets/changelog-github/'

Reproduce

See #48

git clone https://github.com/belgattitude/nextjs-monorepo-example.git && cd nextjs-monorepo-example && git checkout -b fix-deps

Try this to reproduce:

$ YARN_CACHE_FOLDER=./node_modules/.yarn-cache yarn install
# -> BOOM will fail

PS: Weird, if your node_modules existed before it actually works:

$ yarn install
$ YARN_CACHE_FOLDER=./node_modules/.yarn-cache yarn install
# -> OK IT WORKS

But will fail if node_modules is not present (probably .yarn-state.yml)

$ yarn install
$  rm -rf ./node_modules && mkdir -p ./node_modules/.yarn-cache 
$ YARN_CACHE_FOLDER=./node_modules/.yarn-cache yarn install
# -> BOOM it fails

@changeset-bot
Copy link

changeset-bot bot commented May 15, 2021

⚠️ No Changeset found

Latest commit: 587d626

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented May 15, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

nextjs-monorepo-example-blog-app – ./apps/blog-app

🔍 Inspect: https://vercel.com/belgattitude/nextjs-monorepo-example-blog-app/8gkhd5i96nYuT6LbtordCR3FFtRj
✅ Preview: Failed

nextjs-monorepo-example-web-app – ./apps/web-app

🔍 Inspect: https://vercel.com/belgattitude/nextjs-monorepo-example-web-app/6H9drtDdPsn6fETFapgzrni2nkXh
✅ Preview: Failed

@belgattitude belgattitude changed the title chore: fix deps [Repro] Yarn 3.0.0-rc.2 - Fail with YARN_CACHE_FOLDER when no cache May 16, 2021
@belgattitude belgattitude changed the title [Repro] Yarn 3.0.0-rc.2 - Fail with YARN_CACHE_FOLDER when no cache [Repro] Yarn 3.0.0-rc.2 - YARN_CACHE_FOLDER not working on first time May 16, 2021
@belgattitude belgattitude deleted the fix-deps branch October 16, 2021 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant