"Command 'npm' not found" after open terminal, but npm -v show it is installed (installation used nvm)

Viewed 127

I installed npm and node using nvm, and it work's fine, but after computer rebot it shows some errors.

Right after rebot open dialog (in Polish language) saying:

error loading the file /home/pawel/.profile /home/pawel/.bashrc: line 5: npm: command not found

right after open terminal this shows just after computer rebot enter image description here home folder .npm folder home/pawel/.profile

1 Answers

You are using nvm which allows you to have multiple versions of Node.js and to automatically select one of them. This works by placing a script at the end of your .bashrc that allows the correct Node.js to be picked up. So if you try to access npm in the beginning of that same script, it won't work because that path has not been set up.

Related