Ubuntu 24.04 中 nvm 安装 Node 权限问题解决

个人博客地址:Ubuntu 24.04 中 nvm 安装 Node 权限问题解决 | 一张假钞的真实世界

参考nvm的一个issue:https://github.com/nvm-sh/nvm/issues/3363

异常信息如下:

复制代码
$ nvm install 22
Downloading and installing node v22.19.0...
Downloading https://nodejs.org/dist/v22.19.0/node-v22.19.0-linux-x64.tar.xz...
-#O=#    #       #                                                                                                                                                                       Warning: Failed to open the file /home/zhangjc/.nvm/.cache/bin/node-v22.19.0-linux-x64/node-v22.19.0-linux-x64.tar.xz: Permission denied
curl: (23) client returned ERROR on write of 1360 bytes

download from https://nodejs.org/dist/v22.19.0/node-v22.19.0-linux-x64.tar.xz failed
grep: /home/zhangjc/.nvm/.cache/bin/node-v22.19.0-linux-x64/node-v22.19.0-linux-x64.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.
Binary download failed, trying source.
Downloading https://nodejs.org/dist/v22.19.0/node-v22.19.0.tar.xz...
-=#=- #     #       #                                                                                                                                                                    Warning: Failed to open the file /home/zhangjc/.nvm/.cache/src/node-v22.19.0/node-v22.19.0.tar.xz: Permission denied
curl: (23) client returned ERROR on write of 1360 bytes

download from https://nodejs.org/dist/v22.19.0/node-v22.19.0.tar.xz failed
grep: /home/zhangjc/.nvm/.cache/src/node-v22.19.0/node-v22.19.0.tar.xz: 没有那个文件或目录
Provided file to checksum does not exist.

卸载使用 snap 安装的 curl:

复制代码
$ sudo snap remove curl --purge

重新安装 curl:

复制代码
$ sudo apt install curl

再次安装 node 成功:

复制代码
$ nvm install 22
Downloading and installing node v22.19.0...
Downloading https://nodejs.org/dist/v22.19.0/node-v22.19.0-linux-x64.tar.xz...
################################################################################################################################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v22.19.0 (npm v10.9.3)
Creating default alias: default -> 22 (-> v22.19.0)
相关推荐
Frank_refuel4 小时前
终端环境下:Ubuntu 22.04.1 安装 MySQL 数据库
数据库·mysql·ubuntu
yipiantian4 小时前
在Claude项目中实现跨目录访问Skills
linux·运维·服务器
Agent产品评测局4 小时前
生产排期与MES/ERP系统打通,实操方法详解 —— 2026企业级智能体自动化选型与实战指南
java·运维·人工智能·ai·chatgpt·自动化
cen__y4 小时前
Linux07(信号01)
linux·运维·服务器·c语言·开发语言
MT5开发4 小时前
Linux安装MariaDB
linux·运维·mariadb
Lentou5 小时前
日志轮询策略
linux·服务器·网络
Yoyo25年秋招冲冲冲5 小时前
【亲测可用】ubuntu系统下安装Openclaw+配置飞书
linux·ubuntu·ai·飞书·openclaw
你好,帅哥5 小时前
openssl ,msys2 ,交叉编译
linux·运维·服务器
计算机安禾6 小时前
【Linux从入门到精通】第36篇:DNS服务探秘——自己搭建一个内网DNS
linux·运维·servlet
2023自学中6 小时前
make clean 与 make distclean
linux·嵌入式