Running NodeJS on non-system drive

Setup:

I have NodeJS installed on my system (C) drive on a Windows 8 x64 machine. I have QUnit installed globally via npm:

npm install qunit -g

The problem:

If I attempt to reference QUnit with:

var q = require('qunit');

while running NodeJS from any directory on the C drive, everything works as expected. However, when I run it from my projects directory which resides on my secondary E drive, Node cannot find my globally installed package:

Error: Cannot find module 'qunit'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at repl:1:9
    at REPLServer.self.eval (repl.js:109:21)
    at rli.on.self.bufferedCmd (repl.js:258:20)
    at REPLServer.self.eval (repl.js:116:5)
    at Interface.<anonymous> (repl.js:248:12)
    at Interface.EventEmitter.emit (events.js:96:17)

Is there some other configuration I'm missing to be able to use globally installed packages while running NodeJS from my secondary drive? Is this just unsupported? I'd like to not have to locally install them and check them into source control, but it is a backup option if global packages do not work from secondary drives.

https://npmjs.org/doc/folders.html

  • Local install (default): puts stuff in ./node_modules of the current package root.
  • Global install (with -g): puts stuff in /usr/local or wherever node is installed.
  • Install it locally if you're going to require() it.
  • Install it globally if you're going to run it on the command line.
  • If you need both, then install it in both places, or use npm link.

To do this you may want to look into creating a package.json file. Which should include all dependencies for a given project. Then you should be able to run npm install to install all the given dependencies for your project.

There's a related answer here about creating a package.json file.