不能在Windows与崇高的文本2运行节点
问题描述:
节点二进制不能在PATH中找到
考虑使用node_command设置节点插件
为什么它不能找到我的环境变量,which is in the PATH(in the third and fourth line from the bottom)
,这里是我的设置
{
// save before running commands
"save_first": true,
// if present, use this command instead of plain "node"
// e.g. "/usr/bin/node" or "C:\bin\node.exe"
// e.g. "/usr/bin/node" or "C:\bin\node.exe"
"node_command": "C:\\Program Files\nodejs\node",
// Same for NPM command
"npm_command": "C:\\Program Files\nodejs\npm",
// as 'NODE_PATH' environment variable for node runtime
//"node_path": false,
"expert_mode": false,
"ouput_to_new_tab": false
}
这里是我的构建
"cmd": ["node", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.js",
"shell":true,
"encoding": "cp936",
"windows":
{
"cmd": ["taskkill","/F", "/IM", "node.exe","&","node", "$file"]
},
"linux":
{
"cmd": ["killall node; node", "$file"]
}
答
您需要调整,像这样的路径:
"node_command": "C:\\Program Files\\nodejs\\node",
"npm_command": "C:\\Program Files\\nodejs\\npm",
注双反斜线\\
作为目录deliminators。当您在C:
之后用双反斜杠启动路径时,Sublime预计所有删除器都是双反斜杠。或者,你可以让他们所有的单斜杠:
"node_command": "C:/Program Files/nodejs/node",
"npm_command": "C:/Program Files/nodejs/npm",
至于你PATH
而言,你应该从C:\Program Files\nodejs\
删除尾随\
。这可能是Sublime不检查该目录的原因。