美文网首页
Mac下sublime搭建node编译环境

Mac下sublime搭建node编译环境

作者: jiangadam | 来源:发表于2017-01-17 10:15 被阅读173次
  1. 首先你得安装好node.js
    然后用which查看node的位置
which node   ->   /usr/local/bin/node
which npm   ->   /usr/local/bin/npm
  1. 下载sublime的nodejs编译包
    https://github.com/tanepiper/SublimeText-Nodejs

下载编译包,然后解压重命名为Nodejs,拷贝到sublime的Packages中位置为:/Users/jiangadam/Library/Application Support/Sublime Text 2/Packages

  1. 修改配置
Nodejs.sublime-build
{
  "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"]
    },
    "osx":
    {
      "cmd": ["killall node; /usr/local/bin/node $file"]
        // "cmd": ["killall node; node $file"]
    }
}

Nodejs.sublime-settings
{
  // 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"
  "node_command": "/usr/local/bin/node",
  // Same for NPM command
  "npm_command": "/usr/local/bin/npm",
  // as 'NODE_PATH' environment variable for node runtime
  "node_path": false,

  "expert_mode": false,

  "ouput_to_new_tab": false
}

完美解决 bin/sh node commond not found 问题

相关文章

网友评论

      本文标题:Mac下sublime搭建node编译环境

      本文链接:https://www.haomeiwen.com/subject/sqrmbttx.html