问题
I am trying to setup doctorjs on my windows machine, to work with vim's tagbar, but I think this may be a node.js question more than anything else. I'm following this tutorial. Even after I set my NODE_PATH, I still get an error claiming that it needs to be set. What could be going wrong?
Here is a terminal log on my win7 machine:
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:
In node.js 0.6.x the require.paths
has been removed. It has been deprecated since 0.2.x if I recall. So the problem isn't the lack of a NODE_PATH environment variable, but that the package / app you are running isn't compatible with node 0.6.x. Normal solution would be to run this app in node.js 0.4.12. Unfortunately there is no supported version of 0.4.x for Windows. Best bet is to rewrite the application so that require.paths
isn't used anymore.
Furthermore: Don't start the app like node.exe C:\Full\Path\Folder
, because the working directory will be C:\
. Therefore do something like:
C:\Full\Path\Folder> C:\node.js\bin\node.exe Folder.
来源:https://stackoverflow.com/questions/8384840/node-path-error-with-node-js-while-attempting-to-setup-jsctags-for-vim