【问题标题】:apt-get permission error on node.js setupnode.js 设置上的 apt-get 权限错误
【发布时间】:2017-08-18 09:05:17
【问题描述】:

我正在尝试在 ubuntu 上安装 node.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 没有错误,但在运行前两个命令时再次出现错误。

我尝试过autoremovepurgeupgrade,但问题仍然存在。 任何帮助将不胜感激

【问题讨论】:

    标签: node.js ubuntu apt


    【解决方案1】:

    通过运行

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

    您以自己的身份运行 bash,并以 root 身份运行 curl。而 bash 进程的所有者(您)无权写入 /var/lib/apt/lists/partial。
    您可以尝试使用:

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

    您可以查看此article 了解更多信息。

    【讨论】:

    • 如果你使用zsh你必须在运行第二个命令之前手动切换到bash shell,否则设置无法执行
    猜你喜欢
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    • 2018-07-19
    • 2016-07-11
    • 2018-01-02
    • 2018-09-08
    • 2023-03-11
    • 1970-01-01
    相关资源
    最近更新 更多