All Articles

npm not working after installing zsh on Ubuntu 18

In my attempt to improve my cli-fu prowess, I finally installed zsh in my Ubuntu desktop with the help of this article from dev.to.

So far so good, but when I tried to run one of my projects using npm ( something like `npm run start` ), I got this error

command not found npm

wth

When I installed node/npm on my machine, I used nvm. I believe this should be the default when installing it to your machine because you may need to use different versions of node on your projects and nvm will make switching on different versions like a breeze.

In order to use nvm in zsh, edit the .zshrc using this command

sudo nano ~/.zshrc

And look for this line

plugins=(git)

Add nvm inside the parenthesis and save the file, ( Ctrl + X ) + Enter

add zsh

You should now be able to use npm!