How to install Node.js and npm in Termux on Android

Are you looking for a step by step guide to install node js and npm in termux on Android without root? If so, you are at the right place.

Introduction

Nodejs is an open source, platform independent server environment that can run javascript programs on the server. The asynchronous architecture of Nodejs provides a high level of efficiency while handling user requests. Many web servers failed to provide the concurrency and scaling that are fundamental to web development. The majority of the large tech companies and startups have now moved to node js from php since nodejs has a large community that continuously develops APIs, frameworks, and libraries.

Using this tutorial, we will learn how to install a node JS server and npm using termux on an android device without rooting.

How to install Nodejs and npm in Termux on Android

install-nodejs-server-in-termux

Installing nodejs and npm requires installing a terminal emulator first, and then getting installation packages from the repository server.

Let’s see how.

Step 1: Install termux terminal

I assume that you have already installed the termux emulator in your android device. You can read my article here if you haven’t installed it yet. Termux must have access to your local storage files as well, otherwise it may throw an error stating that “Node JS packages could not be found”. So read here the full guide of installation.

Step 2: Update and upgrade the packages

Now you need to update all the packages and the binaries to the latest build. Run the below command.

apt update && apt upgrade

Step 3: Install termux-API

Now you have to make sure that termux has access to your Android and Chrome hardware features. Run the below command.

apt install termux-api

Step 4: Install nodejs packages

Next, you will need to download and install nodejs packages via the cli command. To install nodejs, execute the following command.

apt install nodejs

That’s all. Nodejs is now successfully installed in termux on your Android device without ‘unable to locate package error’.

Run the following command to verify the npm version.

npm -v

The following command can be used to verify nodejs version.

node -v

That’s it. In order to integrate the database with your nodejs based application, I suggest installing phpmyadmin to the backend of your site. In my previous article, I provided detailed instructions on how to install MySQL server in termux, you can read here.

Conclusion

Automation experts and web developers often struggle when it comes to developing and deploying their web applications. They have spent a lot of time deploying their application for user testing. In order to save money and reduce deployment time, Termux plays a vital role. As well as hosting a nodejs server, you can also install python and openSSH server within minutes.

Thank you for reading this article. I hope the above step by step guide has helped you to install nodejs server and npm in your termux terminal without having to root your device. Read a detailed guide here if you’re experiencing “Unable to locate nodejs package.“. To ask any other question, please leave a comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.