开发者

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 开发者_JAVA百科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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜