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

标签 node.js ubuntu apt

我正在尝试在 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/

相关文章:

node.js - 使用 pg-promise 插入多条记录

node.js - res.send,之后如何退出?

ubuntu - 来自 SUN 的 MD5 消息摘要,<正在进行中>

ubuntu - apt-get autoremove 可以删除系统文件吗?

linux - 尝试安装乘客时 Unresolved 依赖关系

javascript - 撇号 CMS - afterInsert 被多次调用

node.js - Passport-local mongoose node.js 支持多种用户类型

php - 从 php 在系统上运行命令

php - 允许内存大小为 268435456 字节耗尽

linux - 如何在 Ubuntu 上通过 CLI 显示 apt 历史记录