I am learning Node.js at the moment on Windows. Several modules are installed globally with npm.cmd, and Node.js failed to find the installed modules. Take Jade, for example,
npm install jade -g
Jade is installed in directory "C:\Program Files (x86)\nodejs\node_modules"
, but the following code will fail with a "Cannot find module 'jade'"
error,
var jade = require('jade');
However, the code will run successfully when Jade is locally installed (without the -g
option in npm). I don't want to use locally-installed modules; it's a waste of disk space for me. How can I make the globally-installed modules work on Windows?