无法在 Google Cloud 上的 Ubuntu VM 实例上打开 VS Code

无法在 Google Cloud 上的 Ubuntu VM 实例上打开 VS Code

我在尝试使用 VNC 查看器在 Google 云中的虚拟机上打开 VS Code 时遇到问题。这是真正的 VNC,我检查了 vscode 没有在多个 VNC 会话中运行。

VM 运行 Ubuntu 18.04 LTS。

我能够安装应用程序 [VS Code] 并看到它与其他应用程序一起列出,但我无法通过单击图标或通过终端运行它来打开它。

当我尝试通过终端运行 VS code 时,它​​没有给出任何错误!

我试着跟随Github 上的相关问题,但我无法解决我的问题。

对于安装,我从 VS code 网站安装了 deb 包并进行了sudo dpkg –i <package_name>安装。

在遵循机器人约翰尼的以下回答后,这是对 的回复code --verbose

Xlib:  extension "XInputExtension" missing on display ":1".
Xlib:  extension "RANDR" missing on display ":1".
Xlib:  extension "XInputExtension" missing on display ":1".
[13988:1206/040556.509538:ERROR:gl_surface_glx.cc(425)] glxQueryVersion failed
[13988:1206/040556.509600:ERROR:gl_initializer_x11.cc(147)] GLSurfaceGLX::InitializeOneOff failed.
[13988:1206/040556.510808:ERROR:viz_main_impl.cc(170)] Exiting GPU process due to errors during initialization
[13966:1206/040556.517587:WARNING:gpu_process_host.cc(1193)] The GPU process has crashed 1 time(s)
Xlib:  extension "XInputExtension" missing on display ":1".
[13966:1206/040556.554491:WARNING:gpu_process_host.cc(967)] Reinitialized the GPU process after a crash. The reported initialization time was 14 ms
[main 2019-12-06T04:05:56.578Z] Starting VS Code
[main 2019-12-06T04:05:56.579Z] from: /usr/share/code/resources/app
[main 2019-12-06T04:05:56.579Z] args: {
  _: [],
  diff: false,
  add: false,
  goto: false,
  'new-window': false,
  'reuse-window': false,
  wait: false,
  version: false,
  help: false,
  telemetry: false,
  'list-extensions': false,
  'show-versions': false,
  verbose: true,
  status: false,
  'prof-startup': false,
  'disable-extensions': false,
  'disable-gpu': false,
  'extension-development-confirm-save': false,
  logExtensionHostCommunication: false,
  'skip-getting-started': false,
  'skip-release-notes': false,
  'sticky-quickopen': false,
  'disable-restore-windows': false,
  'disable-telemetry': false,
  'disable-updates': false,
  'disable-crash-reporter': false,
  'disable-user-env-probe': false,
  'skip-add-to-recently-opened': false,
  'unity-launch': false,
  'open-url': false,
  'file-write': false,
  'file-chmod': false,
  'driver-verbose': false,
  force: false,
  trace: false,
  'force-user-env': false,
  'no-proxy-server': false,
  nolazy: false
}
[main 2019-12-06T04:05:56.580Z] Resolving machine identifier...
[main 2019-12-06T04:05:56.581Z] Resolved machine identifier: 8195d34eeeec20241a1db1a84b63b5309fc06715a4960b3481584f41d87c0955 (trueMachineId: undefined)
[main 2019-12-06T04:05:56.597Z] update#setState idle
[main 2019-12-06T04:05:56.600Z] [storage state.vscdb] 
open(/home/developer/.config/Code/User/globalStorage/state.vscdb, retryOnBusy: true)
[main 2019-12-06T04:05:56.600Z] lifecycle (main): phase changed (value: 2)
[main 2019-12-06T04:05:56.601Z] windowsManager#open
Xlib:  extension "XInputExtension" missing on display ":1".
Xlib:  extension "XInputExtension" missing on display ":1".
[13966:1206/040556.659702:ERROR:atom_browser_main_parts.cc(183)] X IO error received (X server probably went away)

任何帮助将不胜感激。

答案1

听起来要么是 deb 包有问题,要么是其他东西没有正确安装。

我建议从新的虚拟机部署开始,以确保您拥有一个干净的虚拟机。

然后,按照本教程

首先,通过键入以下内容更新包索引并安装依赖项:

sudo apt update
sudo apt install software-properties-common apt-transport-https wget

接下来,使用以下 wget 命令导入 Microsoft GPG 密钥:

wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -

并通过键入以下内容启用 Visual Studio Code 存储库:

sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

启用 apt 存储库后,使用以下命令安装最新版本的 Visual Studio Code:

sudo apt update
sudo apt install code

就是这样。 Visual Studio Code已经安装在你的Ubuntu机器上,你可以开始使用它了;通过终端输入 code或通过 UI。

相关内容