i get this error when trying to install node-red on android:
cannot read property ‘length’ of undefined
this error shown when i type: npm i -g --unsafe-perm node-red
i get this error when trying to install node-red on android:
cannot read property ‘length’ of undefined
this error shown when i type: npm i -g --unsafe-perm node-red
Did you precede that with
pkg install coreutils nodejs
i’ve preceded it with:
apt install coreutils nano nodejs
like in this link:
https://nodered.org/docs/platforms/android
which version of Android ? What does node -v
and npm -v
report back ?
(must admit we don’t regularly test on Android - are there any more error messages than just that one line ?)
Also, since you are using apt rather than pkg, run
apt update
apt upgrade
to make sure everything is the latest version. It probably won’t help but worth doing.
I did this on a cheap ($60) Blu Android 6 phone with Ting as the provider ($10/month since I do no data and no phone calls and never come close to exceeding 300 texts) and use a node red flow to monitor system status (Internet connection, AC power, heartbeat of my IOT Pi3B+ and Beaglebone etc.) and send me SMS messages when something is amiss.
Works great until some Android update makes it spontaneously reboot and it all stops until I dismiss a toast dialog Seems to happen once a month or more.
The Beaglebone which is the main MQTT broker sends an Email to inform me if the Android flow “will” message is received.
Android really needs a new settings switch – “Everything meets all my needs, don’t F’ with it!”
Here are my notes from the installation, straight from a discussion on Google Groups from about a year ago:
// From the Android Play store install:
Termux
Termux:API
//
// start the termux app and run the following commands:
apt update
apt upgrade
apt install coreutils nano nodejs
npm i -g --unsafe-perm node-red
node-red
apt install termux-api
//
// start node red in termux app:
node-red
I made a .profile setting to autostart it, I’d have to look on the phone to see what it was as I forgot to put it in my notes, but it also came from the Google Groups discussion from back then. Termux sells an autostart app, which I was planning to buy, but so far haven’t needed to do so.
I’m having the same problem.
node -v = v8.11.2
npm -v = 5.6.0
Ran all the preceding commands.
This is the error log:
.mux/files/home/.npm/_logs/2018-06-07T17_52_08_662Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ ‘/data/data/com.termux/files/usr/bin/node’,
1 verbose cli ‘/data/data/com.termux/files/usr/bin/npm’,
1 verbose cli ‘i’,
1 verbose cli ‘-g’,
1 verbose cli ‘–unsafe-perm’,
1 verbose cli ‘node-red’ ]
2 info using npm@5.6.0
3 info using node@v8.11.2
4 verbose npm-session 3415649d84795c1b
5 verbose stack TypeError: Cannot read property ‘length’ of un$
5 verbose stack at Object. (/data/data/com.term$
5 verbose stack at Module._compile (module.js:652:30)
5 verbose stack at Object.Module._extensions…js (module.j$
5 verbose stack at Module.load (module.js:565:32)
5 verbose stack at tryModuleLoad (module.js:505:12)
5 verbose stack at Function.Module._load (module.js:497:3)
5 verbose stack at Module.require (module.js:596:17)
5 verbose stack at require (internal/module.js:11:18)
5 verbose stack at Object. (/data/data/com.term$
5 verbose stack at Module._compile (module.js:652:30)
5 verbose stack at Object.Module._extensions…js (module.j$
5 verbose stack at Module.load (module.js:565:32)
5 verbose stack at tryModuleLoad (module.js:505:12)
5 verbose stack at Function.Module._load (module.js:497:3)
5 verbose stack at Module.require (module.js:596:17)
5 verbose stack at require (internal/module.js:11:18)
6 verbose cwd /data/data/com.termux/files/home
7 verbose Linux 4.4.78-perf+
8 verbose argv “/data/data/com.termux/files/usr/bin/node” "/da$
9 verbose node v8.11.2
10 verbose npm v5.6.0
11 error Cannot read property ‘length’ of undefined
12 verbose exit [ 1, true ]
Which version of Android (usually in Settings > About Phone)?
I’m on a One Plus 5T running 8.1.0
can you npm install any other packages ? eg npm i -g npm
to get the latest version of npm.
As is “usual” I have just tried a clean install on my Android tablet and it all installed fine… which doesn’t help.
But see here for a thread on this in Termux - https://github.com/npm/npm/issues/19265 including possible workaround - but not a permanent fix.
Interesting, I get the same error running npm i -g npm
I’ll take a look at the work around tomorrow, thanks.
I tested the workaround, and NPM works now.
"Ha yeah that problem. I just manually edited /usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js to set maxConcurrentWorkers to 1. Then npm will work again."
node -v returns: 8.11.2
npm -v returns :5.6.0
i’m on nexus 4, android version: 8.1
It seems there is a known problem with npm on Android 8
It is not clear to me from that whether there is any ongoing action to fix it.
Had the same problem, fixed with typing:
apt-get install yarn
yarn global add npm
Got the solution from here, https://github.com/termux/termux-packages/issues/1855
i have a problem with install on my xiaomi redmi note 3 pro with android 6.0.1 and this is how the installation process looks like for me https://youtu.be/-_Cbr-tnAvQ please help because the node-red command crashes the error shown below and I do it according to this instruction
would someone be able to help me with android installation? Because those commands didn't help
And this command doesn't help either
Because it still pops up that no module was found
which version of nodejs is it using ?
this is what this error looks like in its entirety
$ node-red
internal/modules/cjs/loader.js:458
throw e;
^
Error: Package exports for '/data/data/com.termux/files/usr/lib/node_modules/node-red/node_modules/async-mutex' do not define a valid '.' target
at resolveExportsTarget (internal/modules/cjs/loader.js:455:13)
at resolveExports (internal/modules/cjs/loader.js:388:16)
at Function.Module._findPath (internal/modules/cjs/loader.js:487:20)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:782:27)
at Function.Module._load (internal/modules/cjs/loader.js:688:27)
at Module.require (internal/modules/cjs/loader.js:850:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/data/data/com.termux/files/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/api/flows.js:37:13)
at Module._compile (internal/modules/cjs/loader.js:958:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:994:10) {
code: 'MODULE_NOT_FOUND'
}
I have node 13.0.0 and npm 12.0
Can you use one of the supported node js versions like 12 or 14 ?