Skip to content

Instantly share code, notes, and snippets.

@shellkore
Created May 1, 2019 18:27
Show Gist options
  • Save shellkore/d6d28741f1d06869c32a6215915f06e8 to your computer and use it in GitHub Desktop.
Save shellkore/d6d28741f1d06869c32a6215915f06e8 to your computer and use it in GitHub Desktop.
solution for problem "Installed node modules globally but still showing error"

To setup path of node modules

Installed node modules globally but still showing error

suppose you installed a node module X-module globally somehting like this node i -g X-module but still getting error when you call that module. Then you might be having NODE_PATH not pointing to your modules. To solve the problem try the following method.

Write your command to install node module globally.check

node i -g X-module

check out the path where the module is installing. In my case it was /usr/local/lib/node_modules/. copy this path.

write following command in terminal.

echo NODE_PATH=your_node_module_path > ~/.bashrc

source ~/.bashrc

Hope it helped you out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment