![WSL2(Ubuntu)sudo snap install--classic 代码不起作用](https://linux22.com/image/1188056/WSL2%EF%BC%88Ubuntu%EF%BC%89sudo%20snap%20install--classic%20%E4%BB%A3%E7%A0%81%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我两年前就已经安装了 vscode,但今天大约 10 天后我打开了 wsl2,代码出现了以下错误(10 天前它还运行良好)
Command 'code' not found, did you mean:
command 'cde' from deb cde (0.1+git9-g551e54d-1.1build1)
command 'cdde' from deb cdde (0.3.1-1build1)
command 'node' from deb nodejs (10.19.0~dfsg-3ubuntu1)
command 'ode' from deb plotutils (2.6-10build1)
command 'tcode' from deb emboss (6.6.0+dfsg-7ubuntu2)
Try: sudo apt install <deb name>
所以我想重新安装 VScode。但是当我输入时,sudo snap install --classic code
它显示error: access denied (see 'snap help login')
systemctl status snapd.service
返回以下内容:-
● snapd.service - Snap Daemon
Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-07-18 12:21:18 IST; 10min ago
TriggeredBy: ● snapd.socket
Main PID: 689 (snapd)
Tasks: 18 (limit: 7474)
Memory: 44.4M
CGroup: /system.slice/snapd.service
└─689 /usr/lib/snapd/snapd
(是的,systemctl 在 WSL2 中默认不起作用,但我找到了一种启用它的方法)
snap version
返回以下内容
snap 2.48+20.04
snapd 2.48+20.04
series 16
ubuntu 20.04
kernel 5.10.102.1-microsoft-standard-WSL2
sudo snap refresh snapd
也不起作用。给出与snap install
请帮忙!