Error migrating to Yarn 2
See original GitHub issueDescribe the bug
yarn install
fails when trying to migrate a clean just-created CRA app to the version 2 (Berry)
Which terms did you search for in User Guide?
These are marked as closed but guys keep reporting the same issue:
Environment
current version of create-react-app: 4.0.0
running from C:\Users\milic\AppData\Local\Yarn\Data\global\node_modules\create-react-app
System:
OS: Windows 10 10.0.19041
CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Binaries:
Node: 12.19.0 - C:\Temp\yarn--1604428991134-0.7984384358311725\node.CMD
Yarn: 1.22.10 - C:\Temp\yarn--1604428991134-0.7984384358311725\yarn.CMD
npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 86.0.4240.111
Edge: Spartan (44.19041.423.0), Chromium (86.0.622.58)
Internet Explorer: 11.0.19041.1
npmPackages:
react: ^17.0.1 => 17.0.1
react-dom: ^17.0.1 => 17.0.1
react-scripts: 4.0.0 => 4.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
yarn create react-app just-app --template typescript
cd just-app
npm install -g yarn
yarn set version berry
git add .
git commit -m "yarn version set to berry"
# at this point I tried to remove node_modules and yarn.lock but in vain
yarn install
Expected behavior
Yarn migrates to the version berry, node_modules go to .yarn/cache
.
Actual behavior
The last command (yarn install
) fails with the following output:
➤ YN0000: ┌ Fetch step
➤ YN0013: │ iferr@npm:0.1.5 can't be found in the cache and will be fetched from the remote registry
...
➤ YN0066: │ fsevents@patch:fsevents@npm%3A2.2.0#builtin<compat/fsevents>::version=2.2.0&hash=127e8e: Cannot apply hunk #1 (set enableInlineHunks for details)
...
➤ YN0000: └ Completed in 17s 59ms
➤ YN0000: Failed with errors in 36s 813ms
Possible workaround
I tried to create a berry structure from the beginning:
# create a higher-level directory
cd test
yarn set version berry
# this way CRA creates a nested directory and inherits the yarn version collecting the dependencies in `.yarn`
yarn create react-app just-app --template typescript
cd just-app
# but created this way, CRA does not start due to https://github.com/facebook/create-react-app/issues/9446
yarn start
# -- Module not found: Your application tried to access react-refresh
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Migration | Yarn - Package Manager
This error appears when Node is executed without the proper environment variables. In such a case, the underlying application won't be able to...
Read more >Migrating to Yarn 2 - Heroku Dev Center
Heroku users using Yarn are not required to migrate to Yarn 2, and users will have access to Yarn 1 in their apps...
Read more >Migrating our Monorepo to Yarn 2 | DoltHub Blog
When I tried it out it worked for the case when there was no yarn. lock file (upgrading dependencies in an individual workspace...
Read more >Migrating to Yarn 2, but Yarn commands "set" and "policies ...
When I run yarn set version berry I get this error: yarn run v1.7.0 error Command "set" not found. This github ...
Read more >What's the problem with Yarn 2? - Nicholas Martin
In the last few days, I've seen a huge divide in opinion about the newly released Yarn 2. Engineers from both Twitter and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Does work with:
yarn set version from sources
yarn add react-refresh eslint-config-react-app
This issue (
fsevents
) is not related to CRA, the rest of the PnP issues are fixed in https://github.com/facebook/create-react-app/pull/9872