Linux上VsCode编译打包运行

Linux上VsCode编译打包运行,第1张

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. /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--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://outofmemory.cn/zaji/586547.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存