我正在尝试在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
purge
和upgrade
,但问题仍然存在。
任何帮助都会非常感激
答案 0 :(得分:9)
运行
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以获取更多信息。