简体   繁体   中英

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

Can someone guide me on a step-by-step to be able to install on my instance the NPM command?

Thanks.

For that, you need to connect to the EC2 instance using the SSH connection.

After you need to install Node.js into the instance. Installing Node.js also installs the Node Package Manager (npm) so you can install additional modules as needed.

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. Use nvm to install Node.js because nvm can install multiple versions of Node.js and allow you to switch between them.
    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.sh
  1. Use nvm to install the latest version of Node.js by typing the following at the command line.
    nvm install node
  1. After you can check the Node.js and NPM versions
   node -v
    npm -v

For more information, you can check AWS Documentation

This is what i tried and worked for me brew

  • Install home brew package manager

/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

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