Loading...
Uncategorized

Installing NodeJS and NPM on Amazon Linux 2

The base installation of Amazon Linux 2 doesn’t have nodejs in it’s default repos. The way that is suggested by AWS is to use nvm to manage the installation.  You can find the official documentation for that here:

https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-up-node-on-ec2-instance.html

To start, you need to SSH in, then use this command to install nvm, which is used to install NodeJS.  

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

It can then be activated by running this command

. ~/.nvm/nvm.sh

After that, you are able to install node with nvm using this command

nvm install node

Once that has completed, node should be installed on the server. You can verify that it is installed properly using this command.

node -e "console.log('Running Node.js ' + process.version)"

That should output the NodeJS version as it does here.

$ node -e "console.log('Running Node.js ' + process.version)"
Running Node.js v15.10.0

Once that has completed, NodeJS is ready to use on the server and should be able to run your applications without any other issues.

Popular Posts
  • No Popular Post Available
Leave a Reply

Your email address will not be published. Required fields are marked *

*