You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu系统使用nvm安装Node.js v10.22.0遇权限拒绝错误求助

Node.js旧版本安装权限问题解决

问题描述

Ubuntu系统已安装Node.js v12.22.9,执行nvm install v10.22.0安装旧版本时,反复出现权限拒绝错误,具体错误信息如下:

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

Binary download from https://nodejs.org/dist/v10.22.0/node-v10.22.0-linux-x64.tar.xz failed, trying source.
grep: /home/wand/.nvm/.cache/bin/node-v10.22.0-linux-x64/node-v10.22.0-linux-x64.tar.xz: 文件或目录不存在
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 12 CPU core(s)
Running with 11 threads to speed up the build
Downloading https://nodejs.org/dist/v10.22.0/node-v10.22.0.tar.xz...
Warning: Failed to open the file                                               
Warning: /home/wand/.nvm/.cache/src/node-v10.22.0/node-v10.22.0.tar.xz: 
Warning: Permission denied
                                                                            0.0%curl: (23) Failure writing output to destination

Binary download from https://nodejs.org/dist/v10.22.0/node-v10.22.0.tar.xz failed, trying source.
grep: /home/wand/.nvm/.cache/src/node-v10.22.0/node-v10.22.0.tar.xz: 文件或目录不存在
Provided file to checksum does not exist.

解决方法

  • 修复nvm缓存目录权限
    错误核心是当前用户对/home/wand/.nvm/.cache目录没有写入权限,执行以下命令修改目录所有者:

    sudo chown -R $USER:$USER /home/wand/.nvm/.cache
    

    执行完后重新运行nvm install v10.22.0即可。

  • 清理缓存后重试
    如果权限修复后仍有问题,先清空nvm缓存再安装:

    nvm cache clear
    nvm install v10.22.0
    
  • 手动下载安装(备选方案)
    若上述方法无效,手动下载安装包后指定路径安装:

    1. 下载node-v10.22.0-linux-x64.tar.xz到本地(比如~/Downloads目录)
    2. 执行命令指定本地文件安装:
      nvm install v10.22.0 --node-dir ~/Downloads
      

内容的提问来源于stack exchange,提问作者Wanderson Silva

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 02:57:32