解决使用code命令时的bash: code: command not found问题

1) 找到下面的文件路径

$HOME/.vscode-server/bin/<directory with a hash-like name>/bin/remote-cli

其中<directory with a hash-like name>的值并不相同, 需要自己获取一下

  1. 查看 $HOME/.vscode-server/bin/<directory with a hash-like name>/bin/remote-cli中的remote-cli下有没有code可执行文件

  2. 有的话在环境变量中导入该路径即可使用

bash 复制代码
export PATH=$HOME/.vscode-server/bin/<directory with a hash-like name>/bin/remote-cli:$PATH

示例

bash 复制代码
export PATH=$HOME/.vscode-server/bin/384ff7382de624fb94dbaf6da11977bba1ecd427/bin/remote-cli:$PATH

为了方便也可以在~/.bashrc文件中设置一下环境变量

相关推荐
wangluoqi4 小时前
c++ 树上问题 小总结
开发语言·c++
Go_Zezhou5 小时前
pnpm下载后无法识别的问题及解决方法
开发语言·node.js
前路不黑暗@5 小时前
Java项目:Java脚手架项目的 C 端用户服务(十五)
java·开发语言·spring boot·学习·spring cloud·maven·mybatis
一个处女座的程序猿O(∩_∩)O5 小时前
Python异常处理完全指南:KeyError、TypeError、ValueError深度解析
开发语言·python
好学且牛逼的马6 小时前
从“Oak”到“虚拟线程”:JDK 1.0到25演进全记录与核心知识点详解a
java·开发语言·python
shangjian0076 小时前
Python基础-环境安装-Anaconda配置虚拟环境
开发语言·python
dingdingfish6 小时前
Bash学习 - 第8章:Command Line Editing,第1-2节:Intro & Readline Interaction
bash·shell·readline
codeJinger6 小时前
【Python】函数
开发语言·python
geovindu7 小时前
python: Command Pattern
开发语言·python·命令模式
Cosmoshhhyyy7 小时前
《Effective Java》解读第41条:用标记接口定义类型
java·开发语言