Skip to content
New issue

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

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

Already on GitHub? # to your account

Error migrating to Yarn 2 #10002

Open
milichev opened this issue Nov 3, 2020 · 7 comments
Open

Error migrating to Yarn 2 #10002

milichev opened this issue Nov 3, 2020 · 7 comments

Comments

@milichev
Copy link

milichev commented Nov 3, 2020

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
@tydira
Copy link

tydira commented Nov 3, 2020

I'm getting the same behavior.

I've also tried yarn create react-app --template cra-template-pwa-typescript --use-pnp project-name with no success, but this seems to fail because of #5647.

@tydira
Copy link

tydira commented Nov 3, 2020

It looks like this PR fixes it. yarnpkg/berry#2078

@merceyz
Copy link
Contributor

merceyz commented Nov 3, 2020

This issue specifically is unrelated to CRA

@dkolba
Copy link

dkolba commented Nov 27, 2020

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

@milichev
Copy link
Author

@dkolba , yes, this is a working workaround.

@timini
Copy link

timini commented Jan 5, 2021

Any plans for the upstream fix to land in CRA or is that not needed?

@merceyz
Copy link
Contributor

merceyz commented Jan 5, 2021

This issue (fsevents) is not related to CRA, the rest of the PnP issues are fixed in #9872

sskmy1024y added a commit to sskmy1024y/react-recoil-practice that referenced this issue May 29, 2021
`yarn set version from sources`
`yarn add react-refresh eslint-config-react-app`
facebook/create-react-app#10002 (comment)
sskmy1024y added a commit to sskmy1024y/react-recoil-practice that referenced this issue May 29, 2021
`yarn set version from sources`
`yarn add react-refresh eslint-config-react-app`
facebook/create-react-app#10002 (comment)
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants