简体   繁体   English

在 Amazon Linux AMI 上安装 NPM

[英]Installing NPM on Amazon Linux AMI

I am new to the computer world and I am struggling to install the npm command on a Amazon Linux AMI 2018.03我是计算机世界的新手,我正在努力在Amazon Linux AMI 2018.03上安装npm命令

Can someone guide me on a step-by-step to be able to install on my instance the NPM command?有人可以指导我一步一步地在我的实例上安装 NPM 命令吗?

Thanks.谢谢。

For that, you need to connect to the EC2 instance using the SSH connection.为此,您需要使用 SSH 连接连接到 EC2 实例。

After you need to install Node.js into the instance.在您需要将 Node.js 安装到实例中之后。 Installing Node.js also installs the Node Package Manager (npm) so you can install additional modules as needed.安装 Node.js 还会安装节点 Package 管理器 (npm),因此您可以根据需要安装其他模块。

Here is the step by step guide on how to do it这是有关如何执行此操作的分步指南

  1. Install node version manager (nvm) by typing the following at the command line.通过在命令行中键入以下内容来安装节点版本管理器 (nvm)。 Use nvm to install Node.js because nvm can install multiple versions of Node.js and allow you to switch between them.使用 nvm 安装 Node.js 因为 nvm 可以安装多个版本的 Node.js 并允许您在它们之间切换。
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
  1. Activate nvm by typing the following at the command line.通过在命令行中键入以下内容来激活 nvm。
    . ~/.nvm/nvm.sh
  1. Use nvm to install the latest version of Node.js by typing the following at the command line.通过在命令行键入以下内容,使用 nvm 安装最新版本的 Node.js。
    nvm install node
  1. After you can check the Node.js and NPM versions之后可以查看 Node.js 和 NPM 版本
   node -v
    npm -v

For more information, you can check AWS Documentation有关更多信息,您可以查看AWS 文档

This is what i tried and worked for me brew这就是我为我尝试和工作的brew

  • Install home brew package manager安装 home brew package 管理器

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh )" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh )"

  • run brew install node , this will install npm too along with node, 1 shot 2 kill:D运行brew install node ,这将与节点一起安装 npm ,1 shot 2 kill:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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