yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.37k stars 2.72k forks source link

Error: Cannot find module '/Users/users/.yarn/releases/yarn-3.5.0.cjs' #8940

Closed ZhQuella closed 1 year ago

ZhQuella commented 1 year ago

I am using the mocos system and installed node version 16.5+ using nvm. I also installed yarn version 1.22.7 using npm, and then updated to the latest version using "yarn set version berry". However, this caused my local projects to fail to start.

I want to revert back to version 1.22.7, but even though I uninstalled it using "npm uninstall", when I reinstall it using "npm install -g yarn", the version is still the latest version 3.5.0.

I then tried using "yarn set version 1.22.7", but it still didn't work. To solve this issue, I searched online and deleted the ".yarn" and "yarnpkg" files, uninstalled yarn, and then reinstalled it. However, I encountered a new error.

Now, I want to go back to the original version. What should I do? Please help me.

users@usersMacBook-Pro ~ % yarn -v
node:internal/modules/cjs/loader:930
throw err;
^

Error: Cannot find module '/Users/users/.yarn/releases/yarn-3.5.0.cjs'
at Function.Module.   _resolveFilename (node:internal/modules/cjs/loader:927:15)
at Function.Module.   _load (node:internal/modules/cjs/loader:772: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: []
}
ZhQuella commented 1 year ago

My problem has been solved. In addition to deleting the .yarn file and yarnpkg file, there is also a .yarn.yml file in the system user directory that needs to be deleted. After deleting it, use npm install -g yarn to get the stable version of yarn.

merceyz commented 1 year ago

Closing since you found the issue.

dimankiev commented 11 months ago

Also don't forget to check on your .yarnrc file, path to yarn module could be specified there as yarn-path. Just remove the yarn-path line to solve the described problem