Amazon ec2 AWS EC2:sudo:apt get:command未找到错误

Amazon ec2 AWS EC2:sudo:apt get:command未找到错误,amazon-ec2,Amazon Ec2,我已经在我的实例中安装了Amazon Linux 2 AMI(HVM),SSD卷类型列表中的第二个操作系统(AWS控制台) 它成功地连接到腻子上 现在我想在我的服务器上安装node 为此,我转到/var文件夹。然后我运行这个命令 curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - 然后我得到了这个错误 ## Populating apt-get cache... + apt-get update bash: apt-g

我已经在我的实例中安装了Amazon Linux 2 AMI(HVM),SSD卷类型列表中的第二个操作系统(AWS控制台)

它成功地连接到腻子上

现在我想在我的服务器上安装node

为此,我转到/var文件夹。然后我运行这个命令

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
然后我得到了这个错误

## Populating apt-get cache...

+ apt-get update
bash: apt-get: command not found
Error executing command, exiting
要解决这个问题,我必须遵守命令

1) apt-get update
2) sudo apt-get update 
3) yum update 
4) sudo yum update

我仍然有同样的问题。任何人都可以帮助我。

通过在命令行键入以下命令来安装节点版本管理器(nvm)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 4.4.5
node -e "console.log('Running Node.js ' + process.version)"
使用nvm安装Node.js,因为nvm可以安装多个版本的Node.js,并允许您在它们之间切换

通过在命令行中键入以下命令来激活nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 4.4.5
node -e "console.log('Running Node.js ' + process.version)"
通过在命令行中键入以下命令,使用nvm安装要使用的Node.js版本

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 4.4.5
node -e "console.log('Running Node.js ' + process.version)"
安装Node.js还将安装Node Package Manager(npm),以便您可以根据需要安装其他模块

通过在命令行中键入以下命令,测试Node.js是否已安装并正确运行

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 4.4.5
node -e "console.log('Running Node.js ' + process.version)"
这将显示以下消息,确认已安装的Node.js版本正在运行

Running Node.js v4.4.5

更多信息:

我对AmazonLinux2AMI知之甚少,但它似乎不是基于debian或ubuntu(APTGET)。因此,您可能希望在基于yum的系统(如fedora、centos、rhel)中找到一个脚本来安装node。谢谢您的回答,但我需要安装node 8。因此,我可以使用
nvm install 8
?您可以在执行命令时将版本改为8。我已经运行了commad。那么,我现在如何更新到8呢?对于其他开发人员:只需确保首先设置8.0版本,然后启动默认设置,然后它将设置为新版本,否则不会: