yarn installation error via npm and brew both

103 views Asked by At

I am Mac user and I have Mac 2017 with MAC OS Sonoma. So far I have dig up every source to find out the answer but unfortunately I haven't find any answer which can solve my problem. Any help would be highly appreciated and Thanks in advance.

Operating System: Mac OS Sonoma Node Versions: v21.7.1, v18.19.1 & v17.9.1 (Node versions are installed via nvm) NVM Version: 0.39.7

Problem Details / Error:

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

Error: Cannot find module '/Users/maddy/.yarn/releases/yarn-4.1.1.cjs' at Module._resolveFilename (node:internal/modules/cjs/loader:1142:15) at Module._load (node:internal/modules/cjs/loader:983:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v21.7.1

I have tried the below methods to install yarn

npm install -g yarn when I type "yarn or yarn -v" it shows the same error as mentioned.

brew install yarn when I type "yarn or yarn -v" it shows the same error as mentioned.

I have removed overall yarn folders or anything which is related to yarn but still not luck so far.

Then again I have tried and I thought it might be the symlink problem which is I know is not but I tried.

brew unlink && brew link yarn

0

There are 0 answers