0

I've just installed Zsh / oh-my-zsh to apply some style and helpful functions to my terminal but it isn't working well.

Here what I did:

sudo apt install zsh

and then I cloned oh-my-zsh with:

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

Created zsh configuration with:

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

And last, changed default Shell with chsh -s /bin/zsh.

After all, I tried to use my terminal like I use it everyday and the npm, for example, isn't working with zsh but with bash only.

Here a print with what I saying:

Printscreen

When I switch from zsh to bash, I can see everything working well. And if I turn back to zsh, continue working.

But if I just open my terminal (in zsh) and try to the npm version, this is what I see.

So, how can I fix this and use zsh totally unconcerned?

I use Ubuntu 18.04 LTS.

  • What's the output of whereis npm in bash? – Hi-Angel Jun 20 at 21:54
  • @Hi-Angel npm: /home/gabriel/.nvm/versions/node/v10.15.3/bin/npm – Gabriel Gambarra Jun 21 at 4:46
0

npm doesn't work for you in zsh because you don't have it in $PATH, which in turn is because it's not from the Ubuntu repository. If you execute in bash whereis npm, you'll find that it's installed in /home/gabriel/.nvm/versions/node/v10.15.3/bin/npm. This means you've downloaded it from somewhere, and then updated bash configuration (most likely the ~/.bashrc file) to add this local installation to $PATH. So, now you need to transfer this part to ~/.zshrc (you can just copy-paste that line, zsh is bash-compatible). The line may probably look like:

export PATH=$HOME/.nvm/versions/node/v10.15.3/bin/npm:$PATH

Note though, if you update this local npm binary, the v10.15.3 part is gonna get changed. So you probably want to use a symbolic link to latest npm binary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.