disheit
disheit

Reputation: 53

Installing NPM on Amazon Linux AMI

I am new to the computer world and I am struggling to install the npmcommand 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.

Upvotes: 5

Views: 8381

Answers (2)

Jatin Mehrotra
Jatin Mehrotra

Reputation: 11513

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

Upvotes: 0

CyberEternal
CyberEternal

Reputation: 2545

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

Upvotes: 11

Related Questions