How to Install Node.JS and NPM on Alpine Linux

Node.js is an open-source, cross-platform Javascript runtime environment, which was built on Google’s V8 Engine and developed using C++, it is an asynchronous server-side scripting language that executes JavaScript outside a web browser to develop scalable network applications.

It allows developers to build data-intensive and high-traffic backend applications such as chat apps and microservices. Notable companies that use Node.JS include GoDaddy, Netflix, Linked, Uber, PayPal, and Twitter just to mention a few.

This short guide demonstrates how to install Node.JS and NPM on Alpine Linux, but before installing, you should know about NPM.

NPM is Node.js’s package manager, which comes with a command-line tool, which you can use to search and install all open-source packages using a single command. You can also control your package’s versions, review dependencies, and even create custom scripts in your projects through the npm command-line utility.

Installing Node.JS on Alpine Linux

To get started, refresh the Alpine Linux repositories by running the following apk command:

# apk update

Next, we are going to install the Node.JS LTS release and NPM which is the package manager for NodeJS.

# apk add --update nodejs npm
OR
# apk add nodejs npm

This installs Node.JS, NPM, and all the additional packages and libraries, and dependencies from the Alpine Linux repositories.

Install Node.JS in Alpine Linux
Install Node.JS in Alpine Linux

If you want to install the current version of Node.js from the community repository, use the following command.

# apk add nodejs-current npm

Once the installation is complete, you can verify if Node.js is installed by running the command:

$ node -v

For NPM, run the following command.

$ npm -v

From the output, you can see that we have installed NodeJS version 16.14.2 and NPM 8.1.3.

Check Nodejs Version
Check Nodejs Version

And that brings us to the end of this short guide. We hope you can now comfortably install Node.JS and NPM on Alpine Linux.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.