一、版本
sublime text3
node
图片.png
二、其他教程好多坑
其实sublime 的nodejs是完全可以按照插件进行安装的,其他教程非要下载包然后配置,还有配置文件内容也不好使
三、我的安装
打开sublime ,按键cmd+shif+p,安装插件
图片.png
搜索nodejs
然后选择安装,当安装好后,找到安装目录
图片.png
找到下面两个文件
图片.png
*****build内容
{
"cmd": ["node", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.js",
"shell": true,
"encoding": "cp1252",
"windows":
{
"shell_cmd": "taskkill /F /IM node.exe & node $file"
},
"linux":
{
"shell_cmd": "killall node; /usr/bin/env node $file"
},
"osx":
{
//"shell_cmd": "killall node; /usr/bin/env node $file"
"cmd": "/usr/local/bin/node; node $file"
}
}
***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": false,
// Same for NPM command
//"npm_command": false,
"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,
"output_to_new_tab": false
}
测试安装成功
control+r快捷键
图片.png
注意:
如果安装nodejs报错,找不到什么模块的话,cnpm install 模块名
安装即可。然后remove插件重新安装。