Skip to content

Error migrating to Yarn 2 #10002

Open
Open
@milichev

Description

@milichev

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions