Answer a question

When I run code in the terminal I get the following error:

$ 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

There's a related issue here: https://github.com/microsoft/vscode/issues/89037.

For the user in the issue, the problem magically solved itself, but how do I solve it?

I can open VS Code directly through the app. I've tried reinstalling the code command.

Diagnostics

$ 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

Answers

pyenv was updated and is pointing to an executable that no longer exists.

This can be resolved by using

pyenv rehash
Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐