So you want to install Node.js in termux on your phone? Yeah, I get it. I started doing this on my own Android device when I got bored of carrying a laptop everywhere just to test small JS scripts. Turns out Termux handles it pretty well once you know the right steps. In This Post I AM Going To Show You How To Install Node.js In Termux. We Will Install Node.js In Termux Using Some Basic And Simple Commands. Let’s get into it.
What You’ll Need First To Install Node.js In Termux.
Nothing fancy here, just:
- Termux app (grab it from F-Droid, the Play Store version is outdated and honestly kind of broken for this stuff)
- Internet connection that isn’t garbage
- A bit of free storage, around 500MB should be more than enough
If you’re already using Termux for other stuff on this blog (sqlmap, theHarvester, you know the drill), you can skip straight to step 2.
Follow The Below Steps One By One To Install Node.js In Termux. Make Sure To Follow The Steps Sequentially So That No Error Occures.
Step 1: Update Everything First
I can’t stress this enough, half the “it’s not working” comments I get are because someone skipped this part. Run:
pkg update -y && pkg upgrade -y
Let it finish completely before moving on. Yes, even if it looks like it’s stuck for a minute.
Step 2: Actually Install Node.js In Termux
This part’s simple. One line:
pkg install nodejs -y
This Will Install Node.js In Termux. If You Want the LTS version instead (more stable, less bleeding-edge)? Use this one:
pkg install nodejs-lts -y
I’d say go with LTS unless you specifically need the newest features for something.
Step 3: Check If It Worked Node.js In Termux
node -v
npm -v
You should see two version numbers pop up. If nothing shows up or you get an error, jump to the fixes section below — I’ve covered the usual suspects.
Step 4: Test It Out
Quick sanity check:
echo 'console.log("Node.js is working in Termux!");' > test.js
node test.js
If that message prints, congrats, you’ve got a working Node setup on your phone.
Step 5: Start Installing Packages
This is where it gets fun. Want nodemon, express, whatever — npm’s got you:
npm install -g nodemon
Errors I’ve Personally Run Into (And How I Fixed Them)
“node: command not found” Annoying but usually a quick fix. Update again, reinstall, and actually close and reopen Termux:
pkg update -y
pkg install nodejs -y
Permission errors when installing packages globally Do NOT try to use sudo here, it’s not gonna work like on a regular Linux box. Instead, redirect npm’s global folder:
npm config set prefix ~/.npm-global
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
Download stuck forever / install just won’t finish Your mirror’s probably slow. Switch it:
termux-change-repo
Pick whatever’s closest to you and retry.
Removing Node.js (If You Ever Need To)
pkg uninstall nodejs -y
Wrapping Up
We Have Seen How To Install Node.js In Termux And that’s pretty much the whole process. Took me longer to figure this out the first time than it should have, mostly because of that permission error above. hopefully this saves you the headache. If you hit any other weird error, drop it in the comments and I’ll try to help you sort it out.
Frequently Asked Questions:
- Can I install Node.js in Termux without root? Yep, no root needed at all. Everything in this guide works on a completely stock, non-rooted Android device.
- Which Node.js version does Termux install by default? Running
pkg install nodejsgrabs whatever the current stable release is in Termux’s repo at the time. If you want the older, more stable LTS branch instead, usepkg install nodejs-ltslike I mentioned above. - How do I switch between Node and Node LTS later? Uninstall whichever one you have first (
pkg uninstall nodejsorpkg uninstall nodejs-lts), then install the other. Termux doesn’t really support having both side by side cleanly. - Why does npm install fail or hang on my phone? Usually it’s your package mirror being slow, not Node itself. Run
termux-change-repoand pick a different mirror, then try again. - Can I run an Express.js server in Termux? Yes. Once Node and npm are working, just
npm install expresslike you would on a normal computer and run your server file withnode. Just remember Termux’s network might be restricted depending on your Android settings. - Does this work on iOS or only Android? Termux is Android-only. There’s no real equivalent for iOS because of how Apple locks down the OS.
- Will installing Node.js in termux drain my battery or use a lot of storage? Node itself is lightweight, only a few hundred MB at most including npm. Battery usage is normal — Termux only uses resources when you’re actively running something.
- I updated Termux and now Node.js is broken. What do I do? Reinstall it with
pkg install nodejs -y(or the LTS version). This usually fixes things after an update.




