代码之家  ›  专栏  ›  技术社区  ›  Kanishka Choudhury

apt获取节点上的权限错误。js设置

  •  2
  • Kanishka Choudhury  · 技术社区  · 7 年前

    我正在尝试安装node。ubuntu上的js 7。运行命令时

    curl -sL https://deb.nodesource.com/setup_7.x | bash -
    

    sudo curl -sL https://deb.nodesource.com/setup_7.x | bash -
    

    我得到以下错误:

    ## Installing the NodeSource Node.js v7.x repo...
    
    
    ## Populating apt-get cache...
    
    + apt-get update
    Reading package lists... Done
    W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
    E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
    E: Unable to lock directory /var/lib/apt/lists/
    W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
    W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
    Error executing command, exiting
    

    我还跑过:

    apt-get update
    

    sudo apt-get update 没有错误,但在运行前两个命令时再次出现错误。

    我已经试过了 autoremove purge upgrade 但问题仍然存在。 任何帮助都将不胜感激

    1 回复  |  直到 7 年前
        1
  •  13
  •   Purple Haze    7 年前

    通过运行

    sudo curl -sL https://deb.nodesource.com/setup_7.x | bash -
    

    你像自己一样跑bash,像root一样卷曲。bash进程的所有者(您)无权写入/var/lib/apt/lists/partial。

    sudo curl -sL https://deb.nodesource.com/setup_7.x | sudo bash  -
    

    article