简体   繁体   中英

Error installing node js on Amazon EC2

I am trying to install Node Js and npm on my new Amazon EC2 instance but I can't succeed in doing so.

I am referring to the official doc: https://nodejs.org/en/download/package-manager/

I run

sudo curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -

But I am getting an error:

error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)

I have seen similar case problems that were solved by using sudo but even using sudo I can't get it.

Thanks for your help !

Adding a sudo right before bash did it for me

curl --silent --location https://rpm.nodesource.com/setup_5.x |sudo bash -

Then

sudo yum install -y nodejs

Use this command and you'll be good to go:

curl -sL https://rpm.nodesource.com/setup_17.x | bash -

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM