我在 Ubuntu 19.04 上安裝 VSCode 時遇到困難,我找到的大多數說明都是在 Ubuntu 18.04/16.04 上安裝 VSCode 的。
首先,我嘗試從 Ubuntu 軟體安裝 VSCode。當我之後打開 vscode 時,程式顯示為空白。即使我重新啟動計算機,然後安裝並重新安裝 VSCode,這種情況仍然持續。
接下來,我嘗試使用安裝 VSCode.deb
VSCode 網站上的選項。我遇到了同樣的問題,當我打開 VSCode 時,我看到的只是一個空白視窗。
最後,我嘗試使用snap安裝VSCode,遵循這些說明。同樣,當我打開 VSCode 時,它是空白的。
接下來我嘗試使用安裝apt
。我運行snap remove vscode
並被告知它不存在,之後我運行“sudo apt install vscode”,它告訴我 vscode 已經是最新版本。我認為發生這種情況是因為我只卸載了用 snap 安裝的版本。
我翻閱了VSCode 文檔並發現有時 GPU 加速問題會導致 VSCode 顯示空白。我嘗試透過運行來停用 GPU 加速code --disable-gpu
,但是當我重新開啟 VSCode 時,它又變成空白了。
總長DR: 如何在 Ubuntu 19.04 上安裝 VSCode?我的下一個計劃是嘗試安裝edge
或test
建置。
我已經讀過關於在 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 相關檔案進行全面清理後,我.deb
從 VSCode 網站下載了該檔案並使用 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