Linux上VsCode编译打包运行

前提:最好使用root用户可以排除一些不必要的错误。

 

一、 准备环境

Node.js(>= 8.12.0, < 9.0.0)

Python2.7

Yarn(可以通过npm install yarn -g 命令安装,前提必须安装好nodejs)

 

关于Node.js安装

curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
nodejs -v #显示对应的版本号表示成功
npm -v #显示对应的版本号表示成功

为了使一些npm包能够工作(例如那些需要从源代码编译代码的包),您需要安装build-essential包:

sudo apt-get install build-essential

 

关于Python(Ubuntu16.04默认自带Python.27,通过如下命令软链接即可)

sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
python -V #显示2.7的版本号表示成功

 

关于Yarn

执行npm install yarn -g (全局安装yarn)

 

执行下面安装linux上所需环境依赖:

sudo apt-get install libx11-dev libxkbfile-dev

sudo apt-get install libsecret-1-dev

sudo apt-get install fakeroot rpm

 

二、 编译运行

(1)    使用git克隆项

git clone https://github.com/Microsoft/vscode.git

 

(2)    进入项目

cd vscode

 

(3)    执行yarn下载所需依赖

yarn

 

(4)    启动监听

yarn watch

 

(5)    启动脚本

./script/code.sh或者bash code.sh 

 

控制台正常结果如下:

 

 

三、 打包

yarn run gulp -- vscode-platform
platform可以为如下(根据不同的平台选择不同的类型):
win32-ia32 | win32-x64 | darwin | linux-ia32 | linux-x64 | linux-arm

以linux为例(打包成功,命令为yarn run gulp -- vscode-linux-x64)显示如下:

 

四、 可能错误

错误信息一:

.build/electron/code-oss: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory

 

解决办法:

sudo apt-get install build-essential

sudo apt-get install libgtk-3-dev

 

错误信息二:

.build/electron/code-oss: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

 

解决办法:

sudo apt-get install libxss1

 

错误信息三:

.build/electron/code-oss: error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory

 

解决办法:

sudo apt-get install libasound2

错误信息四:

 

以打包exe为例,执行yarn run gulp -- vscode-win32-x64(在linux打包exe)

会出现上述问题,解决办法是多次执行yarn run gulp -- vscode-win32-x64 即可解决

 

打包成功的标志如下:

 

转载于:https://www.cnblogs.com/youcong/p/10321321.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值