Running node.js packages on Windows outside the bin dir

I’m using the Node.js for Windows package (currently 0.4.2) downloaded from here:
http://www.rafaljonca.org/d/nodejs-windows

It works great – I can install packages with npm, and run packages like node-inspector, express, etc. The problem is that I can only run those packages if I’m in the bin directory of the distro. I run the setenv.cmd file, which adds bin to the path, but attempting to actually invoke a package (like install another package using npm) when I’m not in the bin path results in the following exception.

Error: Cannot find module '/npm  '
at Function._resolveFilename (module.js:299:11)
at Function._load (module.js:245:25)
at Array.<anonymous> (module.js:402:10)
at EventEmitter._tickCallback (node.js:108:26)

I’ve tried setting the NODE_PATH environment variable to my node package dir, but that doesn’t. help.

Add Comment
1 Answer(s)

Though the question is 4 months old I’ve run into the same issue recently, so hopefully this is still useful.

There is a bug in the runnode.cmd file – there are 2 spaces at the end of line 4, after ‘convArg=%%i’. If you remove them, the script will work.

Answered on July 11, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.