I am learning nodejs at the moment on Windows. Several modules are installed globally with npm.cmd, and nodejs failed to find the installed modules. Take jade for example,
npm install jade -g
"C:\Program Files (x86)\nodejs\node_modules"
"Cannot find module 'jade'"
var jade = require('jade');
Add an environment variable called
NODE_PATH and set it to
%USERPROFILE%\Application Data\npm\node_modules (Windows XP),
%AppData%\npm\node_modules (Windows 7/8/10), or wherever npm ends up installing the modules on your Windows flavor. To be done with it once and for all, add this as a System variable in the Advanced tab of the System Properties dialog (run
I'm pretty much new to node.js myself so I can be not entirely right but from my experience it's works this way:
See similar question for more details: How do I install a module globally using npm?