【问题标题】:can not run node with sublime text 2 in windows无法在 Windows 中运行带有 sublime text 2 的节点
【发布时间】:2015-12-21 07:48:31
【问题描述】:

说明

在 PATH 中找不到节点二进制文件

考虑使用 Node 插件的 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.js sublimetext2


    【解决方案1】:

    你需要像这样调整你的路径:

    "node_command": "C:\\Program Files\\nodejs\\node",   
    "npm_command": "C:\\Program Files\\nodejs\\npm",   
    

    注意双反斜杠\\ 作为目录分隔符。当你在C: 之后以双反斜杠开始路径时,Sublime 期望 all 分隔符是双反斜杠。或者,您可以将它们全部设为单个正斜杠:

    "node_command": "C:/Program Files/nodejs/node",   
    "npm_command": "C:/Program Files/nodejs/npm",   
    

    就您的PATH 而言,您应该从C:\Program Files\nodejs\ 中删除尾随\。这可能是导致 Sublime 不检查该目录的原因。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-20
      • 2014-06-18
      • 2020-04-18
      • 2014-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多