npx:shell-auto-fallback 参数已被删除

2024-06-24

老实说,我不记得我最后在我的机器上安装了什么,我相信它正在酝酿 gatsby-cli。无论如何,从昨天早上开始,当我打开新实例或重置终端(打开新选项卡、源 ~/.zshrc 等)时,我的终端一直给出以下错误。

Last login: Tue Nov 17 10:40:14 on ttys000
npx: the --shell-auto-fallback argument has been removed.
See `npm help exec` for more information

它只是循环,直到我用 ^c 中断命令,即使这样终端基本上处于无效状态,看起来路径还没有完全加载(即我的 .zshrc 文件中的命令,如别名命令,赢得了不执行——未找到命令)。

注意:我使用的是 iterm2。

这是我的 zshrc:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/earlem3/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ZSH_THEME="robbyrussell"
source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to automatically update without prompting.
DISABLE_UPDATE_PROMPT="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(alias-finder brew common-aliases copydir copyfile docker docker-compose dotenv encode64 extract git jira jsontools node npm npx osx urltools vi-mode vscode web-search z)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
  export EDITOR='code'
else
  export EDITOR='nano'
fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias code="code-insiders"
alias iboss="/Applications/Utilities/iboss.app/gen4agent/reconfigure.sh reload"

source ~/.iterm2_shell_integration.zsh

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh

# following 3 commands are all for history-substring-search
source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh
bindkey '^[OA' history-substring-search-up
bindkey '^[OB' history-substring-search-down

#anyenv
eval "$(anyenv init -)"

#nodenv
eval "$(nodenv init -)"

# NPX auto-fallback
source <(npx --shell-auto-fallback zsh)

Per the OhMyZsh github 存储库中 npx 插件的自述文件 https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/npx#deprecation,

Since npm v7, npx已移至npm exec。随着此举,--shell-auto-fallback论证npx已被删除:

Shell fallback functionality is removed, as it is not advisable.

使用 npm v7 时,您会收到此错误:

npx: the --shell-auto-fallback argument has been removed

如果您收到此错误,只需将其从 zshrc 文件中的插件数组。这个插件将不再 维护并将在将来删除,当较旧的 npx 版本不再可用。

按照建议,尝试删除npx从你的以下行.zshrc

plugins=(alias-finder brew common-aliases copydir copyfile docker docker-compose dotenv encode64 extract git jira jsontools node npm npx osx urltools vi-mode vscode web-search z)

..还要删除最后两行.zshrc

# NPX auto-fallback
source <(npx --shell-auto-fallback zsh)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

npx:shell-auto-fallback 参数已被删除 的相关文章

  • 自定义 zsh 在显示上一个命令退出代码时的提示

    Zsh 能够通过使用以下命令在提示中显示上一个命令的返回代码 退出代码 转义序列 不过我想得到以下提示 user host 当退出代码不为 0 且 user host 当退出代码为 0 时 如果我使用 单独它总是显示 即使 是 0 另外我想
  • GIT 和 Ruby:如何从 ruby​​ 脚本内部取消设置 GIT_DIR 变量?

    我编写了一个非常简单的 部署 脚本作为我的post update挂钩到我的裸 git 存储库中 变量如下 live domain mydomain com staging domain stage mydomain com git repo
  • 检查 Git 中是否需要 pull

    如何检查远程存储库是否已更改并且需要拉取 现在我使用这个简单的脚本 git pull dry run grep q v Already up to date changed 1 但它比较重 有没有更好的办法 理想的解决方案是检查所有远程分支
  • 如何扩展路径中的波形符(~)[重复]

    这个问题在这里已经有答案了 我有一个 shell 脚本 可以从用户那里获取目录路径 但我需要检查目录是否为空 如果用户将他的主路径与 而不是绝对路径 所以我无法检查它ls echo Specify your project root dir
  • Jenkins:如何在 Windows 从机中执行 shell 脚本

    我有一个 Windows 从机 安装了 bash 我正在尝试在其上运行 shell 脚本作为预构建步骤 关于我如何做到这一点有什么想法吗 您需要使用脚本作为参数来运行 bash bash yourscript
  • 在 macOS 上使用 find 时出现“非法选项”错误

    我试图列出末尾仅带有字母 R 的文件 我用了find在 macOS 终端中如下所示 find type f name R 但我收到消息说illegal option t 第一个参数find是它应该开始寻找的路径 路径 表示当前目录 find
  • [A-Z] 表示 [A-Za-z] 是怎么回事?

    我已经注意到 至少在我使用的一些基于 Unix 的系统上 ls A Z 已经给了我预期的结果ls A Za z 让我无法轻松获得以大写字母开头的该死的文件列表 我刚刚遇到了同样的事情grep 我无法让它停止与小写字母匹配 A Z 直到我最终
  • UNIX 中 $@ 和 $* 有什么区别?

    有什么区别 and 在UNIX 中 当在脚本中回显时 它们似乎都会产生相同的输出 请参阅特殊参数下的 bash 手册页 Special Parameters The shell treats several parameters speci
  • 使用简单数据结构在 Bash 脚本中进行深度优先搜索

    我正在尝试按照上面所述进行操作 我相对容易地设计了广度优先搜索 该脚本的目标是创建用户输入的具有一定深度和广度的目录结构 我正在尝试改变广度优先实现以支持深度优先搜索 这是我得到的 depthsearch local open seed l
  • 如何找到进程启动时使用的原始用户名?

    有一个 perl 脚本需要以 root 身份运行 但我们必须确保运行该脚本的用户最初没有以用户 foo 身份登录 因为它将在脚本运行期间被删除 那么 我如何查明自登录以来可能已多次起诉的用户是否在该链中的任何时间都没有模拟过 foo 我发现
  • Bash 循环遍历具有行和列的变量

    经过几个小时的搜索测试不同的解决方案后 我尚未找到可行的解决方案 Bash 和 Shell 脚本不是我的强项 我有一个变量 其中有行 换行 和列 制表符分隔 我想要做的是循环遍历行并获取 Column X 然后将该项目放入变量中 以便我可以
  • VSCode 集成终端不加载 .bashrc 或 .bash_profile

    我有以下文件来处理 shell 配置 bash profile if f bashrc then source bashrc fi and bashrc configure shell 如果我使用以下命令从命令行打开 VSCodecode
  • 自动接受安装 NPX 包 [重复]

    这个问题在这里已经有答案了 运行 NPM 包时npx第一次会出现提示询问是否要下载包 例如 如果您运行命令npx some npm package 您会收到以下提示 Need to install the following package
  • 如何使用 HP-UX shell 脚本将简单的文本文件作为附件发送?

    我需要在 HP UX 中使用 shell 脚本发送一封带有文本文件作为附件的电子邮件 我没有安装mutt 我正在使用以下命令 但它在电子邮件正文中发送文件内容 我希望将其作为附件 mailx s Report email protected
  • 如何在 Mac OS X 中通过给出进程名称来获取进程的 PID?

    我正在编写一个脚本来监视任何给定进程的 CPU 和 MEM 为此 我需要将要监视的进程的名称作为命令行参数发送 例如 monitorscript
  • 为什么 bash for 循环出错?

    我正在尝试使用 for 循环运行以下代码 但出现语法错误 请帮忙 输入格式 输入的第一行包含一个整数N 表示整数的个数 下一行包含 N 个空格分隔的整数 它们构成数组 A read n sum 0 for i 1 i lt n i do r
  • 如何在 shell 中解码 URL 编码的字符串?

    我有一个文件 其中包含已编码的用户代理列表 例如 Mozilla 2F5 0 20 28Macintosh 3B 20U 3B 20Intel 20Mac 20OS 20X 2010 6 3B 20en 我想要一个 shell 脚本 它可以
  • 寻找 shell 重定向交错行为的解释

    给定以下脚本 t sh bin bash if eq 0 then log if gt 0 then printf s n else cat fi tee a logged out else log if gt 0 then printf
  • 运行“read PATH”后出现“ls:未找到”

    我正在尝试编写一个小脚本来列出给定变量中的目录 然而我却跑不了ls在读取我对变量的输入之后PATH system bin sh echo enter directory for listing read PATH ls PATH R gt
  • 通过 ssh 运行具有嵌套引号的 shell 命令

    我有以下 shell 命令 ssh user host df grep dev awk BEGIN print DISK USAGE STATUS split 5 a var GREEN print 1 5 var column t 我需要

随机推荐