在bin目录之外的Windows上运行node.js包

我使用的Node.js的Windows包(目前0.4.2)从这里下载: http : //www.rafaljonca.org/d/nodejs-windows

它工作得很好 – 我可以用npm安装软件包,并运行像node-inspector,express等软件包。问题是我只能运行这些软件包,如果我发行版的bin目录中。 我运行setenv.cmd文件,该文件将bin添加到path中,但是当我不在binpath中时,试图实际调用一个包(就像使用npm安装另一个包)会导致以下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) 

我已经尝试将NODE_PATH环境variables设置为我的节点包dir,但是不是。 帮帮我。

虽然问题是4个月大,但最近我遇到了同样的问题,所以希望这个问题仍然有用。

runnode.cmd文件中有一个错误 – 第4行末尾有2个空格,位于'convArg = %% i'之后。 如果你删除它们,脚本将工作。