Reputation: 11
I tried reinstalling yarn but after re-installing I found this problem, I've tried searching the internet but haven't found a solution.
fiii@neo:~$ yarn --version
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/home/fiii/.yarn/releases/yarn-1.22.17.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:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Upvotes: 1
Views: 566
Reputation: 19
Tafadzwa Gonera answers this question quite helpfully here:
Running
rm ~/.yarnrc
andrm ~/.yarnrc.yml
and worked for me. Don't worry if either file isn't there.~/.yarnrc
was not found in my case so I ended up deleting~/.yarnrc.yml
only. I logged out and in to the terminal and ran yarn --version and got1.22.5
Why does this solution work?
When I rannpm install -g yarn
ornpm install -g yarn@berry
yarnrc
and/oryarnrc.yml
were/was created with the yarnPath pointing to/home/[username]/.yarn/releases/yarn-berry.cjs
. Runningyarn --version
would run a lookup foryarn-berry.cjs
based on the yarnPath Sinceyarn-berry.cjs
wasn't there the runtime would trigger an appropriate error hence it makes sense that removingyarnrc
and/oryarnrc.yml
solves the issue.
Upvotes: 2