我已经安装了Sublime Text的NodeJS插件,它提供了如下所示的NodeJS构建: { "cmd": ["node", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.js", "shell":true, "encoding": "cp1252", "windows
{ "cmd": ["node", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.js", "shell":true, "encoding": "cp1252", "windows": { "cmd": ["taskkill /F /IM node.exe & node", "$file"] }, "linux": { "cmd": ["killall node; node", "$file"] } }
我自己编译了节点并找到了:/opt/node/v0.10.24. bin的完整路径是/opt/node/v0.10.24/bin/node.
我正在用一个包含console.log(‘Hello World’)的简单文件来测试它;
运行构建系统时,我得到:
/Users/jviotti/Desktop/test.js: node: command not found [Finished in 0.0s with exit code 127]
我尝试像这样添加一个构建路径:
"path": "/opt/node/v0.10.24/bin",
在运行构建时,我得到:
[Finished in 0.1s]
请注意,不会打印控制台日志.我错过了什么?
编辑:这是我使用的NodeJS插件:https://github.com/tanepiper/SublimeText-Nodejs
这应该做..{ "cmd": ["node $file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.js", "shell": false, "encoding": "cp1252", "windows": { "cmd": ["taskkill /F /IM node.exe && node $file"] }, "linux": { "cmd": ["killall nodejs 2>/dev/null; nodejs $file"] // or node, if built from source } }