bash - 当我得到`./MacOS/Electron: No such file or directory`时,如何从终端启动VS Code?
问题描述
当我code
在终端中运行时,出现以下错误:
$ code .
/Users/manuphatak/.pyenv/shims/python: line 21: /usr/local/Cellar/pyenv/1.2.21/libexec/pyenv: No such file or directory
/usr/local/bin/code: line 10: ./MacOS/Electron: No such file or directory
这里有一个相关的问题:https ://github.com/microsoft/vscode/issues/89037 。
对于问题中的用户,问题神奇地自行解决了,但我该如何解决呢?
我可以直接通过应用程序打开 VS Code。我试过重新安装code
命令。
诊断
$ cat "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
function realpath() { python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$0"; }
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
ELECTRON="$CONTENTS/MacOS/Electron"
CLI="$CONTENTS/Resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?
$ cat /Users/manuphatak/.pyenv/shims/python
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
program="${0##*/}"
if [[ "$program" = "python"* ]]; then
for arg; do
case "$arg" in
-c* | -- ) break ;;
*/* )
if [ -f "$arg" ]; then
export PYENV_FILE_ARG="$arg"
break
fi
;;
esac
done
fi
export PYENV_ROOT="/Users/manuphatak/.pyenv"
exec "/usr/local/Cellar/pyenv/1.2.21/libexec/pyenv" exec "$program" "$@"
$ cat /usr/local/Cellar/pyenv/1.2.21/libexec/pyenv
cat: /usr/local/Cellar/pyenv/1.2.21/libexec/pyenv: No such file or directory
$ pyenv --version
pyenv 1.2.22
解决方案
pyenv
已更新并指向不再存在的可执行文件。
这可以通过使用解决
pyenv rehash
推荐阅读
- elasticsearch - 将丢失的 LogStash 日志与 Kibana 仪表板中的正确日期匹配
- php - 解决了!将 Ajax 添加到顶部横幅
- swift - 我们如何在 SwiftUI 中将图像按钮放在圆形图像的角下方?
- java - 如何使用注释在 Spring Boot 应用程序中的同一类中注入不同类型的相同通用接口的两个实例
- java - 将查询结果映射到 dto
- objective-c - Objective-C,Typhoon,将程序集作为参数传递
- mongodb - ERR_CONNECTION_TIMED_OUT - mongodb
- reactjs - 在某些情况下,如何防止 react-persist 将数据存储到本地存储?
- python - 如何将实时坐标从位置文件发送到python中的不同文件?
- java - 为什么它是初始化新实例化(非持久)实例的集合值属性的最佳方式?