gpt4 book ai didi

node.js - zsh : command not found: npm

转载 作者:太空宇宙 更新时间:2023-11-04 02:51:55 26 4
gpt4 key购买 nike

我刚刚使用以下命令安装了 Node 和 Yarn:

brew install node
brew install yarn --without-node

node -v
v11.8.0

-a node
node is /usr/local/bin/node

yarn -v
1.13.0
type -a yarn
yarn is /usr/local/bin/yarn

但是,如果我在终端 npm 中写入,则会显示“zsh:找不到命令:npm”

在我的:~/.zshrc中,我有:

ZSH=$HOME/.oh-my-zsh

# You can change the theme with another one:
# https://github.com/robbyrussell/oh-my-zsh/wiki/themes
ZSH_THEME="robbyrussell"

# Useful plugins for Rails development with Sublime Text
plugins=(gitfast last-working-dir common-aliases sublime zsh-syntax-highlighting history-substring-search)

# Prevent Homebrew from reporting - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md
export HOMEBREW_NO_ANALYTICS=1

# Actually load Oh-My-Zsh
source "${ZSH}/oh-my-zsh.sh"
unalias rm # No interactive rm by default (brought by plugins/common-aliases)

# Load rbenv if installed
export PATH="${HOME}/.rbenv/bin:${PATH}"
type -a rbenv > /dev/null && eval "$(rbenv init -)"

# Rails and Ruby uses the local `bin` folder to store binstubs.
# So instead of running `bin/rails` like the doc says, just run `rails`
# Same for `./node_modules/.bin` and nodejs
export PATH="./bin:./node_modules/.bin:${PATH}:/usr/local/sbin"

# Store your own aliases in the ~/.aliases file and load the here.
[[ -f "$HOME/.aliases" ]] && source "$HOME/.aliases"

# Encoding stuff for the terminal
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

我尝试使用本指南卸载并重新安装 Node 和 Yarn:How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

但我仍然遇到同样的错误。

最佳答案

当我在 ~/.zshrc 开头添加 source ~/.bash_profile 时,它对我有用,而且我还必须删除

test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"

~/.bash_profile中。这是我无意中从 iTerm2 安装的 shell 集成。

关于node.js - zsh : command not found: npm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54390473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com