I’ve used nvm to install the latest stable node and npm, and can use both from an interactive shell just fine, but not from UI apps. For example, I’d like geany to lint my js code, but it says ‘jshint: command not found’. However, I can use jshint from the shell no problem.
I assume this is because although I’ve added ‘source ~/.nvm/nvm.sh’ to my ‘~/.zshrc.sh’ as per npm installation instructions, this is only used for interactive shells.
What’s the right thing to do here? I’ve found 8 potentiall startup files I could be using but are unsure of which one to use: ~/.zprofile? ~/.zlogin? Or is there a better way to do this altogether?
OK, after a bit of experiementation I got it working by adding the source…nvm.sh line only to ~/.bash_profile. ~/.bash_profile appears to source ~/.bashrc, but weirdly adding the source to ~/.bashrc didn’t work - it has to be in ~/.bash_profile.
And to make things a tad more confusing, it appears the KDE distro uses both bash and zshell somehow but I have no idea what the implications of that are!
Why don’t you use repo packages?
There are already few topics around about that if you search. Yes, Manjaro uses Konsole profile with zsh.
Exporting your local nvm path in ~/.profile could do the trick. You may need to logout for the change to take effect.
If you are developing something locally which you want to by executing a desktop entry you will need use a script or set the nvm path in the desktop entry.
From the nvm package install file
You need to source nvm before you can use it. Do one of the following
or similar depending on your shell (and then restart your shell):
echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.bashrc
echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.zshrc
You can now install node.js versions (e.g. nvm install 10) and
activate them (e.g. nvm use 10).
init-nvm.sh is a convenience script which does the following:
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
You may wish to customize and put these lines directly in your
.bashrc (or similar) if, for example, you would like an NVM_DIR
other than ~/.nvm or you don't want bash completion.
See the nvm readme for more information: https://github.com/creationix/nvm