Ubuntu nvm 安装node curl 报错

本文写于2023.01.16

问题描述

使用 nvm install v19.4.0 安装 node 报错:

Downloading and installing node v19.4.0...
Downloading https://nodejs.org/dist/v19.4.0/node-v19.4.0-linux-x64.tar.xz...
Warning: Failed to open the file                                               
Warning: /home/wang/.nvm/.cache/bin/node-v19.4.0-linux-x64/node-v19.4.0-linux-x
Warning: 64.tar.xz: Permission denied
curl: (23) Failure writing output to destination

Binary download from https://nodejs.org/dist/v19.4.0/node-v19.4.0-linux-x64.tar.xz failed, trying source.
grep: /home/wang/.nvm/.cache/bin/node-v19.4.0-linux-x64/node-v19.4.0-linux-x64.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.
Binary download failed, trying source.
Downloading https://nodejs.org/dist/v19.4.0/node-v19.4.0.tar.xz...
Warning: Failed to open the file                                               
Warning: /home/wang/.nvm/.cache/src/node-v19.4.0/node-v19.4.0.tar.xz: 
Warning: Permission denied
curl: (23) Failure writing output to destination

Binary download from https://nodejs.org/dist/v19.4.0/node-v19.4.0.tar.xz failed, trying source.
grep: /home/wang/.nvm/.cache/src/node-v19.4.0/node-v19.4.0.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.

解决思路

观察报错信息,发现下载安装包时就报错了,错误信息为 curl: (23) Failure writing output to destination

Snipaste_2023-01-17_09-21-19.png

出现这个错误,首先想到我的 curl 是通过 snap 安装的,那么卸载使用apt重装试试。

解决方案

确认一下你的curl是不是用snap安装的:

sudo snap list | grep curl

有输出,则为snap安装,则卸载:

sudo snap remove curl

然后用apt重新安装:

sudo apt install curl

最后重新运行安装命令

nvm install v19.4.0
Logo

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

更多推荐