#nvm在install node的时候报错

最近creat react项目的时候发现node版本太低需要update,本来电脑上已经安装了nvm,只需要install一下就可以了,但是无奈报了下面这一大堆,烦人:

Downloading and installing node v16.15.0…
mkdir: /usr/local/opt/nvm/.cache/bin/node-v16.15.0-darwin-x64/files: Permission denied
creating directory /usr/local/opt/nvm/.cache/bin/node-v16.15.0-darwin-x64/files failed
Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-darwin-x64.tar.gz…

curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to nodejs.org:443
Binary download from https://nodejs.org/dist/v16.15.0/node-v16.15.0-darwin-x64.tar.gz failed, trying source.
grep: /usr/local/opt/nvm/.cache/bin/node-v16.15.0-darwin-x64/node-v16.15.0-darwin-x64.tar.gz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
mkdir: /usr/local/opt/nvm/.cache/src/node-v16.15.0/files: Permission denied
creating directory /usr/local/opt/nvm/.cache/src/node-v16.15.0/files failed
Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0.tar.gz…
Warning: Failed to create the file
Warning: /usr/local/opt/nvm/.cache/src/node-v16.15.0/node-v16.15.0.tar.gz: No
Warning: such file or directory

curl: (23) Failed writing body (0 != 1107)
Binary download from https://nodejs.org/dist/v16.15.0/node-v16.15.0.tar.gz failed, trying source.
grep: /usr/local/opt/nvm/.cache/src/node-v16.15.0/node-v16.15.0.tar.gz: No such file or directory
Provided file to checksum does not exist.

解决办法:export NVM_DIR=“ H O M E / . n v m " [ − s " HOME/.nvm" [ -s " HOME/.nvm"[s"NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh”

就这样很快解决了,主要原因是权限不够

GitHub 加速计划 / nv / nvm
78.06 K
7.82 K
下载
nvm-sh/nvm: 是一个 Node.js 版本管理器,用于在不同的 Node.js 版本之间进行切换。它可以帮助开发者轻松管理多个 Node.js 版本,方便进行开发和测试。特点包括轻量级、易于使用、支持跨平台等。
最近提交(Master分支:2 个月前 )
9c9ff4ba Moved issue template into ISSUE_TEMPLATE folder 1 天前
51ea809d - 1 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐