Categories
JavaScript Answers

How to fix global Node modules not found with JavaScript?

Spread the love

To fix global Node modules not found with JavaScript, we set the NODE_PATH environment variable.

We run

echo $NODE_PATH

to print the value of the NODE_PATH environment variable.

If it’s empty, we add

nano ~/.bash_profile
export NODE_PATH=`npm root -g`
source ~/.bash_profile

to add NODE_PATH to the .bash_profile file to make the global packages visible.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *