Installing NPM on Amazon Linux AMI

Viewed 3937

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.

2 Answers

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

Related