在 Ubuntu 19.04 上安装 VSCode

在 Ubuntu 19.04 上安装 VSCode

我在 Ubuntu 19.04 上安装 VSCode 时遇到了困难,我找到的大多数说明都是关于在 Ubuntu 18.04/16.04 上安装 VSCode 的。

首先,我尝试从 Ubuntu Software 安装 VSCode。之后当我打开 vscode 时,程序显示为空白。即使我重新启动计算机然后安装并重新安装 VSCode,这种情况仍然持续。

接下来,我尝试使用以下方式安装 VSCode.debVSCode 网站上的选项。我遇到了同样的问题,当我打开 VSCode 时,我看到的只是一个空白窗口。

最后,我尝试使用 snap 安装 VSCode,按照这些说明。再次,当我打开它时,VSCode 是空白的。

接下来我尝试使用 进行安装apt。我运行snap remove vscode后被告知它不在那里,之后我运行了“sudo apt install vscode”,它告诉我 vscode 已经是最新版本。我想这是因为我只卸载了使用 snap 安装的版本。

我翻遍了VSCode 文档发现有时 GPU 加速问题会导致 VSCode 显示空白。我尝试通过运行来禁用 GPU 加速code --disable-gpu,但当我重新打开 VSCode 时它又空白了。

结论:如何在 Ubuntu 19.04 上安装 VSCode?我的下一个计划是尝试安装edgetest构建。

我已经读过了关于在 18.04 上安装的这个问题并按照说明进行操作。我无法按照这些说明安装 VSCode。

更新/var/log/apt/term.log:以下是我的输出vs code安装尝试

Log started: 2019-05-16  14:05:45
Selecting previously unselected package code.
(Reading database ... 176942 files and directories currently installed.)
Preparing to unpack .../code_1.33.1-1554971066_amd64.deb ...
Unpacking code (1.33.1-1554971066) ...
Setting up code (1.33.1-1554971066) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Log ended: 2019-05-16  14:05:48

Log started: 2019-05-20  12:13:37
(Reading database ... 186403 files and directories currently installed.)
Removing code (1.33.1-1554971066) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Log ended: 2019-05-20  12:13:37

Log started: 2019-05-20  12:13:54
Selecting previously unselected package code.
(Reading database ... 184660 files and directories currently installed.)
Preparing to unpack .../code_1.34.0-1557957934_amd64.deb ...
Unpacking code (1.34.0-1557957934) ...
Setting up code (1.34.0-1557957934) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Log ended: 2019-05-20  12:13:57

Log started: 2019-05-20  12:35:47
(Reading database ... 186403 files and directories currently installed.)
Removing code (1.34.0-1557957934) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Log ended: 2019-05-20  12:35:47

Log started: 2019-05-20  12:38:15
Selecting previously unselected package code.
(Reading database ... 184660 files and directories currently installed.)
Preparing to unpack .../code_1.34.0-1557957934_amd64.deb ...
Unpacking code (1.34.0-1557957934) ...
Setting up code (1.34.0-1557957934) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Log ended: 2019-05-20  12:38:18

Log started: 2019-05-20  12:49:21
(Reading database ... 186403 files and directories currently installed.)
Removing code (1.34.0-1557957934) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Log ended: 2019-05-20  12:49:21

Log started: 2019-05-20  21:37:40
(Reading database ... 186403 files and directories currently installed.)
Removing code (1.34.0-1557957934) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Log ended: 2019-05-20  21:37:40

另一个更新:我解决了这个问题。我重复了之前卸载 VSCode 的所有步骤,我还检查了/etc/apt/sources.list.d 此目录是否包含一些 VSCode 配置文件,我将其删除。我还检查了.config主目录中的目录,发现它也包含一些 vscode 配置,我将其删除。在对与 VSCode 相关的文件进行全面清理后,我从 VSCode 网站下载了该.deb文件并使用 Ubuntu 的软件安装程序进行了安装。成功!

答案1

在你的终端中尝试以下命令:

sudo apt update
sudo apt install software-properties-common apt-transport-https wget
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
sudo apt install code

相关内容