skip to Main Content

Trying to upgrade from React Native to 0.73.6 to 0.74.2.

React Native upgrade instructions said to add the following

packageManager": "[email protected]

to package.json and add the following to a file ".yarnrc.yml" with this content. There is no directory yarn/releases/yarn-3.6.4.cjs

nodeLinker: node-modules yarnPath: .yarn/releases/yarn-3.6.4.cjs

But I now get the following error

node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module ‘/Users/user/Dir/Dir2/.yarn/releases/yarn-3.6.4.cjs’
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: ‘MODULE_NOT_FOUND’,
requireStack: [] }

I have attempted to set yarn to berry and have performed corepack enable
Node.js v20.14.0

2

Answers


  1. Chosen as BEST ANSWER

    Finally figured it out. In your project directory and your home directory run remove all yarn files and folders. $cd ~ && rm -rf .yarn/ && rm -f yarn.lock then run $ yarn set version 3.6.4.

    I then had issues with Watchman so I ran $ brew uninstall watchman && brew update && brew install watchman followed by $ watchman watch-del-all $ watchman shutdown-server

    Hope this saves you a few hours


  2. seems like removing ~/.yarn is not necessary

    this is what worked for me:

    • before adding .yarnrc.yml, i tried yarn set version 3.6.4
      • it downloads .yarn/releases/yarn-3.6.4.cjs and updates the package.json (adds the "packageManager": "[email protected]" line)
    • run yarn
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search