"Browse packages(浏览插件)",或者sublime安装目录下的Data\Packages4)..._sublimetext3 插件node.js">
当前位置:   article > 正文

sublime text 3 安装Nodejs插件

sublimetext3 插件node.js

如题

1)集成Nodejs插件到sublime,地址:https://github.com/tanepiper/SublimeText-Nodejs
2)解压zip文件, 并重命名文件夹“Nodejs”
3)打开sublime的插件文件夹,操作"preference(首选项)" --> "Browse packages(浏览插件)",或者sublime安装目录下的Data\Packages
4)“Nodejs”复制到插件文件夹
5)打开Nodejs文件夹,更改配置文件。打开文件“Nodejs.sublime-build”

  1. {
  2. "cmd": ["node", "$file"],
  3. "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
  4. "selector": "source.js",
  5. "shell":true,
  6. "encoding": "cp1252",
  7. "windows":
  8. {
  9. "cmd": ["taskkill /F /IM node.exe & node", "$file"]
  10. },
  11. "linux":
  12. {
  13. "cmd": ["killall node; node", "$file"]
  14. }
  15. }

把cp1252修改为GB2312或者utf8,防止build nodejs代码时终端显示乱码 ,修改如下

  1. {
  2. "cmd": ["node", "$file"],
  3. "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
  4. "selector": "source.js",
  5. "shell":true,
  6. "encoding": "utf8",
  7. "windows":
  8. {
  9. "cmd": ["taskkill /F /IM node.exe & node", "$file"]
  10. },
  11. "linux":
  12. {
  13. "cmd": ["killall node; node", "$file"]
  14. }
  15. }

 

6)再打开文件“Nodejs.sublime-settings”,或者设置“preference(首选项)”-->“package settings(插件设置)”-->Nodejs”-->“setting-default”

  1. {
  2. // save before running commands
  3. "save_first": true,
  4. // if present, use this command instead of plain "node"
  5. // e.g. "/usr/bin/node" or "C:\bin\node.exe"
  6. "node_command": false,
  7. // Same for NPM command
  8. "npm_command": false,
  9. // as 'NODE_PATH' environment variable for node runtime
  10. "node_path": false,
  11. "expert_mode": false,
  12. "ouput_to_new_tab": false
  13. }

修改如下

  1. {
  2. // save before running commands
  3. "save_first": true,
  4. // if present, use this command instead of plain "node"
  5. // e.g. "/usr/bin/node" or "C:\bin\node.exe"
  6. "node_command": /usr/bin/nodejs,
  7. // Same for NPM command
  8. "npm_command": /usr/bin/npm,
  9. // as 'NODE_PATH' environment variable for node runtime
  10. "node_path": false,
  11. "expert_mode": false,
  12. "ouput_to_new_tab": false
  13. }

  

转载于:https://www.cnblogs.com/Zev_Fung/p/6408793.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/79585
推荐阅读
相关标签
  

闽ICP备14008679号