question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error migrating to Yarn 2

See original GitHub issue

Describe 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:open
  • Created 3 years ago
  • Reactions:9
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
dkolbacommented, Nov 27, 2020

Does work with: yarn set version from sources yarn add react-refresh eslint-config-react-app

0reactions
merceyzcommented, Jan 5, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found