node.js - 尝试安装 nvm

标签 node.js macos nvm

我正在尝试安装 nvm 但不断出现错误。
我运行安装脚本curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash我得到

=> nvm is already installed in /Users/xxxxx/.nvm, trying to update using git
=> => Compressing and cleaning up git repository

=> nvm source string already in /Users/xxxxx/.bash_profile
=> bash_completion source string already in /Users/xxxxx/.bash_profile
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

/Users/xxxxx/.nvm/versions/node/v10.17.0/lib
└── yarn@1.22.4
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:

     $ nvm use system
     $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm or run the following to use it now:

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
如果我关闭并打开一个新的终端窗口并使用 nvm -v 检查 nvm
我得到zsh: command not found: nvm

最佳答案

Mac OS 修复

export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
在此之后关闭终端并再次打开它。
瞧它应该像魅力一样工作

关于node.js - 尝试安装 nvm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62680089/

相关文章:

node.js - Socket.io 和 Passport - 在套接字连接上获取护照用户 ID?

node.js - 何时迁移到下一个 Node.js 版本

macos - 在 Mac 上使用并行和 Visual Studio 2013 进行 checkin 时出现 TFS 访问被拒绝错误

objective-c - SpriteKit sks 文件的用途

node.js - Forever, NVM, Nodejs with Crontab, app 抛出错误

node.js - 如何使用 Mocha 和 Zombie.js 测试 headless Express 应用

javascript - Node js - 如何将多个 SVG 文件提供给浏览器

macos - bower 安装失败给我 EACCES : permission denied error

pm2 - 找不到 npm 命令 pm2 : command not found

node.js - root 在项目目录中找不到 gulp 命令