Ubuntu环境下sublime3 nodejs安装与插件配置

在Ubuntu中按CTRL+ALT+T打开命令窗口,按下面步骤和命令进行安装即可:
添加sublime text 3的仓库:
1 sudo add-apt-repository ppa:webupd8team/sublime-text-3
回车,出现很多信息。但是我们看看图片最后字知道,这地方在等待我们确认是否添加这个仓库,按enter键继续,按crtl+c取消。
此时,按ENTER继续,建立信任数据库。
2 sudo apt-get update 
3 安装Sublime Text 3: 
sudo apt-get install sublime-text-installer
然后等待安装…………


安装完成后要安装nodejs插件
2)  下载sublime的nodejs插件,需是集成Nodejs插件到sublime中,下载地址:https://github.com/tanepiper/SublimeText-Nodejs
3)   解压zip文件, 并重命名文件夹“Nodejs”
4)   打开sublime,操作"preference" --> "Browse packages", 打开一个目录,这个目录是众多语言IDE插件的存放地。
5)   复制”Nodejs“文件夹到这个目录。  这样就可以了吗? 酱样子还不行,还要更改配置文件。
6)   打开Nodejs文件夹,找到文件“Nodejs.sublime-build”, 拖拽到sublime,显示:       

<pre name="code" class="plain">{
  "cmd": ["node", "$file"],
  "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
  "selector": "source.js",
  "shell":true,
  "encoding": "utf8",
  "windows":
    {
    	"cmd": ["node", "$file"]
    },
  "linux":
    {
        "cmd": ["killall node; node $file"]
    },
    "osx":
    {
	"cmd": ["killall node; node $file"]
    }
}


 


 需要更改上面标注的地方, 要更改encoding为GB2312或者utf8,如果不更改此属性可能导致build nodejs代码时终端显示乱码。

7)  要用sublime打开文件“Nodejs.sublime-settings” 或者 设置“preference” --》 “package settings” --》 “Nodejs”  --》“setting-default” 打开文件并 更改,将node 和 npm命令路径配置,我的nodejs路径为/home/wawa/NodeJs/node-v4.2.2-linux-x64/

{
  // 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": /home/wawa/NodeJs/node-v4.2.2-linux-x64/bin/node,
  "node_command": /home/wawa/NodeJs/node-v4.2.2-linux-x64/bin/node,
  // Same for NPM command
  "npm_command": /home/wawa/NodeJs/node-v4.2.2-linux-x64/bin/npm,
  // as 'NODE_PATH' environment variable for node runtime
  "node_path": false,

  "expert_mode": false,

  "ouput_to_new_tab": false
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值