Setting up NODE_PATH for using global packages via require(…)

Khan MNM Sadh
inside the insight
Published in
1 min readJun 18, 2015

Node.js intends global install for applications only. If you want to use some package in your project via require('...') the recommended way is to put them in projects root. However, you may want some packages to install globally via npm install -g package and use them on your node projects. Then, you have to make sure you have the %NODE_PATH% system variable set up to point global node_modules directory, e.g.: %USERPROFILE%\AppData\Roaming\npm\node_modules for Windows 8.

--

--