Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installation Problem: Cannot find module Yarn

Today I decided to install yarn and I tried to install it with npm i -g and brew install, however whenever I run yarn -v this error appears:

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/Users/franciscomendes/.yarn/releases/yarn-berry.cjs'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

When I run the which yarn command this is the path that appears (when I install with HomeBrew):

/usr/local/bin/yarn

When I look for .yarn using which .yarn this appears in the terminal:

.yarn not found

If I install globally with npm and then list my global dependencies, note that I have version 1.22.11, however the error persists.

/Users/franciscomendes/.npm-global/lib
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── npm@
├── [email protected]
└── [email protected]

And when I run the which yarn command, this is the path that appears:

/Users/franciscomendes/.npm-global/bin/yarn

Do you have a solution for this problem?

P.S.:By the way, node and npm work normally (as well as others).

like image 619
learnbydoing Avatar asked Nov 25 '25 04:11

learnbydoing


1 Answers

Check if you have an .yarnrc file in your repo, if you have it, just delete it and try to run yarn and must work

like image 164
Miguel Angel Velasco Avatar answered Nov 26 '25 21:11

Miguel Angel Velasco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!