119
社区成员




容器为什么一直无法安装 node.js 呀,是什么原因呢?试了好多次了,完全浪费时间呀!
开了 10 核心 CPU 都不好使,什么鬼环境呀!
$ nvm install 18.12.0
Downloading and installing node v18.12.0...
Downloading https://nodejs.org/dist/v18.12.0/node-v18.12.0-linux-x64.tar.xz...
####### 5.8%curl: (18) transfer closed with 22317628 bytes remaining to read
Binary download from https://nodejs.org/dist/v18.12.0/node-v18.12.0-linux-x64.tar.xz failed, trying source.
grep: /root/.nvm/.cache/bin/node-v18.12.0-linux-x64/node-v18.12.0-linux-x64.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.
Binary download failed, trying source.
Local cache found: ${NVM_DIR}/.cache/src/node-v18.12.0/node-v18.12.0.tar.xz
Computing checksum with sha256sum
Checksums do not match: 'bc1b7fbc585cf4f51dc0f8dfec3238e132c944343db96f6426af5c1ae50823cc' found, '73a7f01e2999eb197763ced666a6cd544ad580eaefb73e0a849603b3e804f42e' expected.
Checksum check failed!
Removing the broken local cache...
Downloading https://nodejs.org/dist/v18.12.0/node-v18.12.0.tar.xz...
## 1.5%curl: (56) OpenSSL SSL_read: 连接被对方重设, errno 104
Binary download from https://nodejs.org/dist/v18.12.0/node-v18.12.0.tar.xz failed, trying source.
grep: /root/.nvm/.cache/src/node-v18.12.0/node-v18.12.0.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.
nvm将安装镜像设置成国内镜像就行了,默认的镜像在海外,访问速度超级不稳定
在终端里执行下面的命令后再使用 nvm 安装 node 试试看。
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
对了,安装 node 和 npm 后,记得给 npm 也换成淘宝的源
npm config set registry https://registry.npm.taobao.org
欧了 ✅