Kanishka Choudhury
Kanishka Choudhury

Reputation: 548

apt-get permission error on node.js setup

I am trying to install node.js 7 on ubuntu. on running the command

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

or

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

i get the following error:

## 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

I have also run:

apt-get update

this again results in the error above, however when i run sudo apt-get update there is no error but again on running the first two commands give error again.

i have tried to autoremove purge and upgrade but still the problem persists. any help will be much appreciate

Upvotes: 2

Views: 3326

Answers (1)

Purple Haze
Purple Haze

Reputation: 550

By running

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

You were running bash as yourself, and curl as root.and the owner of the bash process (you) didn't have rights to write to /var/lib/apt/lists/partial.
You can try using :

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

You can check this article for more information.

Upvotes: 15

Related Questions