apt在node.js安装程序上获取权限错误

apt在node.js安装程序上获取权限错误,node.js,ubuntu,apt,Node.js,Ubuntu,Apt,我正试图在ubuntu上安装node.js7。在运行命令时 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 direc

我正试图在ubuntu上安装node.js7。在运行命令时

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

我已尝试
自动删除
清除
升级
,但问题仍然存在。 如果您有任何帮助,请运行

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  -

有关更多信息,请查看此项。

如果使用zsh,则必须在运行第二个命令之前手动切换到bash shell,否则无法执行设置
sudo curl -sL https://deb.nodesource.com/setup_7.x | sudo bash  -