gpt4 book ai didi

node.js - node.js 设置上的 apt-get 权限错误

转载 作者:搜寻专家 更新时间:2023-11-01 00:11:00 25 4
gpt4 key购买 nike

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

我已尝试autoremove purgeupgrade 但问题仍然存在。任何帮助将不胜感激

最佳答案

通过运行

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获取更多信息。

关于node.js - node.js 设置上的 apt-get 权限错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45752738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com