NPM module command not found

Sat, 29 Jun 2019

Until you properly config your environment you'll probably run into the command not found error when trying to run globally installed NPM modules.

Solution for Linux and OSX:

Step 1 - check if the path is correct

You need to have **/users/<ME>/.npm-global/bin** in your $PATH

echo $PATH

If the printed string doesn't contain the above path, continue to Step 2

Step 2 - add npm global install path

We need to adjust the $PATH in order to contain the path to the NPM global module folder:

export PATH=$PATH:~/.npm-global/bin

Step 3 - reload .bashrc

The .bashrc file is usually only reloaded on startup. Run the bellow command to reload it again after you made the changes from Step 2.

source ~/.bash_profile

That's all. Your global NPM modules should now work in your terminal.

Categories: linux, nodejs, npm