【问题标题】:sh: nodemon: command not foundsh:nodemon:找不到命令
【发布时间】:2020-11-23 02:18:44
【问题描述】:

我用 source ~/.zshrc 更改了我的 zsh 的源代码,并且在 package.json 中使用 npm run 命令时我的所有 npm 包都停止了工作。我试图在网上搜索答案,他们说要添加 bash 源。我没有安装 bash,也不知道之前的配置文件在哪里。我在zshrc 文件中添加了要导出的各种行,但它没有修复我的包。

我收到的错误

sh: nodemon: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT

这是我的 .zsrch

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="/usr/lib/google-cloud-sdk/bin:$PATH"

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/admin/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/admin/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/admin/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/admin/google-cloud-sdk/completion.zsh.inc'; fi

export PATH=$PATH:/Users/admin/npm/bin
export PATH=$PATH:~/npm
export PATH=$HOME/.local/bin:$PATH
export PATH=/usr/local/share/npm/bin:$PATH

我不想使用-g 全局安装nodemon,因为这发生在我的所有软件包中。我无法在全球范围内安装所有最后一个包,package.lock 中有 500 个这样的包

【问题讨论】:

  • 您声称使用zsh,但错误消息显示sh正在执行代码,而不是zsh。除此之外,请检查您的 PATH,即验证您所做的设置是否确实有效。

标签: node.js bash npm


【解决方案1】:

我通过删除我的 node_modules 文件夹并再次执行 npm 安装来修复它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-10
    • 1970-01-01
    相关资源
    最近更新 更多