Node.js
Run JavaScript away from the browser, on a server or the CLI
About
Node.js runs JavaScript away from the browser. It reaches files, the network and the operating system. Use it for servers, command-line tools or front-end build steps.
Install it
pkg install nodejs-lts
Run this inside Termux. If the package is already present, pkg will say so and
do nothing.
Commands worth knowing
5 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.
node script.js Run a saved JavaScript file and print its output. Test a script before wiring it into anything. node -e console.log(process.version) Evaluate a short snippet straight from the command line, without creating a file. node -v Print the installed runtime version. Useful when a package demands a minimum. node --check script.js Parse a file for syntax errors without running it. node -i Open an interactive prompt, where you can try expressions one at a time. Worked example
Run node -p process.versions and this is what you should see.
$ node -p process.versions
{
node: '20.11.1',
v8: '11.3.244.8',
uv: '1.46.0',
openssl: '3.0.13'
} The runtime reports the versions of its key components.
Developed by
The OpenJS Foundation · released under MIT.