尝试为vim设置jsctags时,node.js出现NODE_PATH错误

时间:2011-12-05 11:49:30

标签: node.js vim ctags jsctags

我正在尝试在我的Windows机器上设置doctorjs,使用vim的标签栏,但我认为这可能是一个node.js问题比什么都重要。我正在关注this tutorial。即使在我设置了NODE_PATH之后,我仍然会收到错误声明需要设置它。可能出现什么问题?

这是我的win7机器上的终端日志:

C:\Windows\system32>set NODE_PATH=C:\Users\JG\Desktop\new\doctorjs\lib\jsctags

C:\Windows\system32>node.exe C:\Users\JG\Desktop\new\doctorjs\bin\jsctags.js -h
'node.exe' is not recognized as an internal or external command,
operable program or batch file.

C:\Windows\system32>cd c:\Users\JG\Desktop\new\doctorjs

c:\Users\JG\Desktop\new\doctorjs>node.exe C:\Users\JG\Desktop\new\doctorjs\bin\j
sctags.js -h

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH envi
ronment variable instead.
    at Function.<anonymous> (module.js:376:11)
    at Object.<anonymous> (C:\Users\JG\Desktop\new\doctorjs\bin\jsctags.js:41:8)

    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)

c:\Users\JG\Desktop\new\doctorjs>

1 个答案:

答案 0 :(得分:3)

在node.js 0.6.x中,require.paths已被删除。如果我记得,它自0.2.x以来已被弃用。所以问题不在于缺少NODE_PATH环境变量,而是您运行的包/ app与节点0.6.x不兼容。正常的解决方案是在node.js 0.4.12中运行此应用程序。不幸的是,Windows版没有受支持的0.4.x版本。最好的办法是重写应用程序,以便不再使用require.paths

此外:不要像node.exe C:\Full\Path\Folder那样启动应用,因为工作目录将是C:\。因此,请执行以下操作:

C:\Full\Path\Folder> C:\node.js\bin\node.exe Folder.