A day back, I wrote about Setting up Hyper terminal with ZSH on Windows machine.
Although the setup might work flawless, but there were some hiccups when I tried Node projects with it.
So here are notes on the problems I faced and solutions I opted for.
Your Window's NodeJs installation wont work in WSL. You would need to install it again using:
sudo apt install nodejs sudo apt install npm
- When trying to npm, you might see below:
Solution to this is to remove the
node_modules directory and install the packages again:
rm -rf ./node_modules
Still there might be cases where you can face problems like one below.
Where I am trying to install
gatsby-cli but failed because of write permissions.
For the solution, you can refer to this StackOverflow answer.
As suggested in the SO answer, I decided to use
nvm. Which felt a great option after reading about it.
So I removed node and npm using apt and installed nvm as below:
Get the shell script
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh -o install_nvm.sh
After verifying, run it
It added its following stuff to the
.bashrcfile So i had to move it to
.zshrcto make it work.
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_complet>
- Restart the hyper terminal or source the
You can list available node version with following command
Then you can install node as
nvm install 14.15.1
Try checking node version to verify installation
You can list node installations with
Switching between versions can be achieved as below
nvm alias fix-bug 12.18.3 nvm use fix-bug
After setting up node with nvm. Everything worked smoothly.
node_modules directory and start fresh.
Thats it for this note.
HIH ~ RD
If you think this is helpful 🎈
Don't keep it to yourself 🙊
Share it with your lovely followers at twitter 🗽