Global Yarn Install on WSL?

I’ve installed node into WSL/Ubuntu. From my root dir, yarn --version works. When I attempt to use it in a project dir, I get this error:
Error: Cannot find module '/mnt/d/Projects/git/.yarn/releases/yarn-1.22.10.cjs'
The coded I used for the install:

sudo apt remove yarn
curl -sS | sudo apt-key add -
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn -y
yarn -g install

Which indicates that node is looking for Yarn in the local project dir.
I found yarn using the which command, but even the calling it from via it’s absolute path yields the same error:

~/.nvm/versions/node/v15.4.0/bin/yarn --version

If anyone know the fix it would be greatly appreciated.

As it turned out, there was a .yarn.rc file in the dir above my project. This contained a “yarn-path” which prevented both Yarn and NPM from accessing Yarn within the project.
Too many moving parts…

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.