去官網下載 .deb 安裝檔
https://code.visualstudio.com/download
使用 dpkg 指令安裝 Visual Studio Code
sudo dpkg -i code_1.31.1-1549938243_amd64.deb
如果發生錯誤訊息:
dpkg: dependency problems prevent configuration of code:
code depends on libnotify4; however:
Package libnotify4 is not installed.
....
code depends on libxss1; however:
Package libxss1 is not installed.
dpkg: error processing package code (--install):
dependency problems - leaving unconfigured
Processing triggers for mime-support (3.60ubuntu1) ...
Errors were encountered while processing:
code
先執行 sudo su 換 root 權限
輸入
sudo apt update
sudo apt-get -f upgrade
執行更新一下
再安裝相關依賴的函示庫
sudo apt install libnotify4 libnss3 libxkbfile1 libsecret-1-0 libgtk-3-0 libxss1
再輸入一次安裝 Visual Studio Code
sudo dpkg -i code_1.31.1-1549938243_amd64.deb
應該是就安裝成功了(到這一步,我安裝成功了)
輸入 code 執行 Visual Studio Code
如果發生錯誤訊息:
/usr/share/code/bin/../code: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
輸入
sudo apt-get install libxss1
如果還是一樣發生錯誤,可以試試輸入
sudo apt-get install gconf-service libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxss1 libxtst6 libappindicator1 libnss3 libasound2 libatk1.0-0 libc6 ca-certificates fonts-liberation lsb-release xdg-utils wget
安裝完
輸入 code --version 測試 Visual Studio Code 是否安裝成功!
顯示版本號,安裝成功!