Disclaimer
Node.js are able to read and write the entire system, I'm not responsible for any stolen data, accounts or something. Install it at your own rist!
Since version 1.1.4
requires this module Systemless mksh.rc to be installed.
mmrl install -yr node_on_android
- Some binaries can't be used when
/system
it not linked into/usr
. You need to charge from#!/usr/bin/env node
to#!/system/bin/env node
node-gyp
isn't available. Someone need to portspython
- Learn more how to make
node-gyp
work
- Learn more how to make
- Do not update
yarn
itself. This can break the functionality.
- Please don't execute global installed binaries on boot. This module need link
/system
to/usr
first! - This module uses an own
mkshrc
file, this causes problems with some other modules, like Terminal modifications. Be uninstalling these modules before using this!
Files must be located in /system/etc/node.d
and running on every boot after 2 minutes.
Valid file extensions:
*.js
*.cjs
*.mjs
Since 1.1.4 NPM is useable!
# Install npm via yarn
yarn global add npm
# npm will only works when /system is into /usr linked
# If not - you have to change from "#!/usr/bin/env node" to "#!/system/bin/env node"
nano $(realpath $(which npm))
This is an small binary that just executes npm in a short way
grf add wget
# grf add audiotools
# grf add bash
More can you find in Googlers-Repo/addons
If you want develop global libraries for usage use please:
#!/system/bin/env node
or this (not recommended)
#!/usr/bin/env node
/system
is linked to/usr
which makes it possible to executenpm
ornodemon
Node.js version: 16.15.1
Yarn version: 1.23.0
Module can be downloaded from FoxMMM. The instalation should be always be in FoxMMM.
Included binaries
yarn
node
const { SystemProperties, Build } = require("android");
const id = SystemProperties.get("ro.build.id");
console.log(id);
// alternatively can you use:
console.log(Build.ID);
// List props
const props = SystemProperties.list();
// With own callback
// SystemProperties.list((prop)=> {
// console.log(prop)
// });
console.log(props);
Logging in JavaScript is 1:1 the same as in Java
const { Log } = require("android");
const TAG = "TEST";
Log.i(TAG, "Logging from JavaScript, %s!", "Kevin");
Check in logs
logcat -s TEST:*
Logging in JavaScript is 1:1 the same as in Java
const { Environment } = require("android");
const user = Environment.whoami();
const rootfs = Environment.rootfs();
const home = Environment.homedir();
const tmp = Environment.tmpdir();
console.log({
user,
home,
rootfs,
tmp,
});
// 'System.getenv()' is deprecated
const home = Environment.getenv("HOME");
console.log(home);
ROOTFS is customizable via
setprop
Example:setprop persist.mkshrc.rootfs /data/<NEW_NAME>