【问题标题】:Why have nvm related commands —nvm, node, npm— stopped working?为什么与 nvm 相关的命令(nvm、node、npm)停止工作?
【发布时间】:2017-08-14 20:52:43
【问题描述】:
os: macOS Sierra 10.12.6 (16G29)
terminal app: Hyper 1.3.3.1754
nvm: 0.33.2

我按照说明安装了nvm,前段时间没有问题。最近,它和它负责的命令——nodenpm——停止工作。

找不到 nvm/npm/node 命令

【问题讨论】:

    标签: shell command-line config nvm dotfiles


    【解决方案1】:

    我意识到发生这种情况是因为我最近将系统默认 shell 从 bash 切换到 zsh —chsh -s /bin/zsh — 没有解决 ~/.bash_profile 的内容,bash 提供而不是 zsh

    nvm 安装脚本
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
    将以下内容放在适当的配置文件中——其中之一:~/.bash_profile~/.zshrc~/.profile~/.bashrc

    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
    

    在安装时,我使用了bash,该位被放置在~/.bash_profile 中。将该内容处理到~/.zshrc 后,这些命令又可以正常工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-10
      • 1970-01-01
      相关资源
      最近更新 更多