错误信息:
Command 'code' not found, did you mean:
command 'cde' from deb cde (0.1+git9-g551e54d-1.1build1)
command 'node' from deb nodejs (10.19.0~dfsg-3ubuntu1)
command 'tcode' from deb emboss (6.6.0+dfsg-7ubuntu2)
command 'cdde' from deb cdde (0.3.1-1build1)
command 'ode' from deb plotutils (2.6-10build1)
Try: apt install <deb name>
折腾wsl2时碰到多次 ,谷歌搜了不少,但是都不能解决
大概率是 code 的PATH 没有生效:
记录一下方便日后参考:
重做一遍: Get started using Visual Studio Code with Windows Subsystem for Linux
----重启电脑再试。
追加1:
- 发现进入wsl2 后做过su 切换用户的动作 会导致code . 失效,将用户且回去也不行。
- 确认code 环境变量生效时 可试试重启wsl2 后再试一下:
追加2 关于root 账户提示:
参考:
It is recommended to start vscode as a normal user.
To run as root, you must specify an alternate user data directory with the --user-data-dir argument.
暂得 root 用户不推荐操作