- Node.js Version:14.0.0
- OS: MacOS 10.15.4
- Scope (install, code, runtime, meta, other?): Yarn install
- Module (and version) (if relevant): internal/modules/cjs/loader.js
Upon running any Yarn command, I get the following error. This is after reinstalling and following this sequence of commands:
YARN UNINSTALL:
yarn cache clean
- open terminal
- rm -rf node_modules yarn.lock yarn-error.log package-lock.json
- brew uninstall --force yarn
- npm uninstall -g yarn
- yarn -v
- which yarn
- rm -rf ~/.yarn (OPTIONAL, not recommended)
- rm -rf /usr/local/bin/yarn
- rm -rf /usr/local/bin/yarnpkg
- which yarn
NPM & NODE UNINSTALL:
- keep adding to terminal
- brew uninstall --force node
- brew cleanup
- sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
- sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp
- sudo rm -rf /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules
- sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.d
- brew doctor
- brew cleanup --prune-prefix
INSTALL:
- same terminal
- brew install yarn
- brew install node
- brew link node
- sudo chmod 776 /usr/local/lib
- brew link --overwrite node
- sudo chmod 755 /usr/local/lib
- brew link node
- yarn policies set-version
- n 12.13.1
11. yarn -v && node -v && npm -v
Then the following appears on terminal upon running yarn command at step 9 of the install:
USER-MacBook-Pro:~ User$ yarn
internal/modules/cjs/loader.js:1017
throw err;
^
Error: Cannot find module '/Users/jlagos/.yarn/releases/yarn-1.21.1.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: [ ]
}
Any help on how to restore Yarn? Seems like node is keeping track of a previous yarn version.