I've recently downloaded WSL on my system as well as Ubuntu 20.04 LTS.
I installed Node JS on it and it seems to work fine. But when I tried installing yarn from the following command:
curl -o- -L https://yarnpkg.com/install.sh | bash
It installed yarn 1.22.5 and when I ran yarn --version
, it returned 1.22.5
But when I changed the directory to /mnt/c/Users/user-name
and tried running yarn --version
, it threw this error:
internal/modules/cjs/loader.js:888
throw err;
^
Error: Cannot find module '/mnt/c/users/user-name/C:\Users\user-name\.yarn\releases\yarn-1.22.10.cjs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Is there any way to fix this?
I found a solution to this:
Check this page out. Click on Alternatives
and select the operating system Debian / Ubuntu
and version Classic Stable (1.22.5)
.
You can follow the given instructions to install yarn from the Debian package repository, then have a look at the Path Setup
section. Follow the instructions given there and yarn will be available globally!
Then you can run yarn --version
any where in you're Ubuntu shell and it should be working just fine!