noia-network / noia-node-cli

NOIA node headless (terminal) sample for noia-node.
GNU Lesser General Public License v2.1
11 stars 4 forks source link

WebRTC does not support arm64 architecture. #8

Open franciscorubin opened 6 years ago

franciscorubin commented 6 years ago

I'm getting this error when executing the cli:

error: [noia-contents-client] uncaughtException: Unable to find native module date=Wed Aug 15 2018 17:09:46 GMT+0000 (UTC), pid=24904, uid=1000, gid=1000, cwd=/home/ubuntu/.noia, execPath=/usr/bin/node, version=v8.11.3, argv=[/usr/bin/node, /home/ubuntu/.yarn/bin/noia-node-cli, --masterAddress, ws://csl-masters.noia.network:5565, --userDataPath, /home/ubuntu/.noia, --storageDir, /home/ubuntu/.noia/storage, --walletAddress, 0xXXXXXXXXXXXXXXXXXXXXXXXXXXXX], rss=37801984, heapTotal=32841728, heapUsed=14874904, external=191574, loadavg=[0.09326171875, 0.107421875, 0.22509765625], uptime=13341, trace=[column=20, file=/home/ubuntu/.config/yarn/global/node_modules/node-cmake/index.js, function=requireNativeModule, line=40, method=null, native=false, column=39, file=/home/ubuntu/.config/yarn/global/node_modules/wrtc/lib/binding.js, function=null, line=3, method=null, native=false, column=30, file=module.js, function=Module._compile, line=652, method=_compile, native=false, column=10, file=module.js, function=Module._extensions..js, line=663, method=.js, native=false, column=32, file=module.js, function=Module.load, line=565, method=load, native=false, column=12, file=module.js, function=tryModuleLoad, line=505, method=null, native=false, column=3, file=module.js, function=Module._load, line=497, method=_load, native=false, column=17, file=module.js, function=Module.require, line=596, method=require, native=false, column=18, file=internal/module.js, function=require, line=11, method=null, native=false, column=15, file=/home/ubuntu/.config/yarn/global/node_modules/wrtc/lib/index.js, function=null, line=3, method=null, native=false], stack=[Error: Unable to find native module, at requireNativeModule (/home/ubuntu/.config/yarn/global/node_modules/node-cmake/index.js:40:20), at Object. (/home/ubuntu/.config/yarn/global/node_modules/wrtc/lib/binding.js:3:39), at Module._compile (module.js:652:30), at Object.Module._extensions..js (module.js:663:10), at Module.load (module.js:565:32), at tryModuleLoad (module.js:505:12), at Function.Module._load (module.js:497:3), at Module.require (module.js:596:17), at require (internal/module.js:11:18), at Object. (/home/ubuntu/.config/yarn/global/node_modules/wrtc/lib/index.js:3:15)]

MartynasZilinskas commented 6 years ago

Could you upload log of this command?

$ npm install @noia-network/node-cli -g --verbose
franciscorubin commented 6 years ago

Here it is:

https://gist.github.com/pancho111203/891b133d0bf95d52464f0a39494801dc

MartynasZilinskas commented 6 years ago

What is your: Node.js, npm, OS versions?

franciscorubin commented 6 years ago

Node: v8.11.3 npm: 5.6.0

OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS Release: 16.04 Codename: xenial

MartynasZilinskas commented 6 years ago

I recommend upgrading Node.js to v9.1.1 and reinstall node-cli.

franciscorubin commented 6 years ago

@MartynasZilinskas I just tried with that version, but no luck... Exact same error :(

Dancia commented 6 years ago

Are you running 32 or 64 bit? The error log might mean that it couldn't find prebuild wrtc module which is compatible with your system, so it couldn't download it. So module not found error was thrown. WRTC support source (https://github.com/js-platform/node-webrtc):

x86 x64 arm arm64
Linux ✔︎
macOS ✔︎
Windows ✔︎
franciscorubin commented 6 years ago

Oh, I see. I'm running it on a Pine64 (https://www.pine64.org). It's arm64. So does it mean that my device is incompatible or is there any workarounds?

Dancia commented 6 years ago

To explain it properly I will have to give more details.

NOIA Node CLI and NOIA Node GUI need wrtc module to run WebRTC in desktop environment. The problem is that this wrtc module is native, which means that it has to be compiled to run with a particular processor (such as an Intel x86-class processor) and its set of instructions. In your case it's arm64 processor.

In standard case NOIA Node determines what processor given machine has and tries to download particular binary for given OS/processor/else. Currently wrtc in its repository doesn't have prebuild binaries for arm64 processor, so your installation fails.

does it mean that my device is incompatible

It's not that it's not compatible, it's just that there's no ready to use prebuild binaries for your machine. The solution would be to compile it itself, but you have to be power user to do it, since it might be to complicated for regular users! There is discussion pretty much about it here: https://github.com/js-platform/node-webrtc/issues/388

So there are three possible paths we can take from here:

  1. Hope that wrtc module will start hosting binaries for arm64 and other popular processors too.
  2. Users could build it themselves completely on their own.
  3. NOIA could try to built it and host somewhere or write some instructions or help improve wrtc (https://github.com/js-platform/node-webrtc) so users know how to build it.

There's a lot of things in our roadmap, this one is not listed, but if many people will face the same issue, we will put more man hours into trying to solve this issue!

Appendinx npm install when it fails to download and compile

When you run npm install, you might see something like this:

earching for a pre-built wrtc binary
node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://node-webrtc.s3.amazonaws.com/wrtc/v0.1.6/Release/node-v57-linux-arm.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (/home/noia/.nvm/versions/node/v8.11.4/lib/node_modules/@noia-network/node-cli/node_modules/node-pre-gyp/lib/install.js:118:27)
node-pre-gyp ERR! stack     at emitOne (events.js:121:20)
node-pre-gyp ERR! stack     at Request.emit (events.js:211:7)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/home/noia/.nvm/versions/node/v8.11.4/lib/node_modules/@noia-network/node-cli/node_modules/node-pre-gyp/node_modules/request/request.js:1074:10)
node-pre-gyp ERR! stack     at emitOne (events.js:116:13)
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:211:7)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:543:21)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:112:17)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:440:20)
node-pre-gyp ERR! stack     at emitOne (events.js:116:13)
node-pre-gyp ERR! System Linux 4.14.62-v7+
node-pre-gyp ERR! command "/home/noia/.nvm/versions/node/v8.11.4/bin/node" "/home/noia/.nvm/versions/node/v8.11.4/lib/node_modules/@noia-network/node-cli/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build=false"
node-pre-gyp ERR! cwd /home/noia/.nvm/versions/node/v8.11.4/lib/node_modules/@noia-network/node-cli/node_modules/wrtc
node-pre-gyp ERR! node -v v8.11.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
404 status code downloading tarball https://node-webrtc.s3.amazonaws.com/wrtc/v0.1.6/Release/node-v57-linux-arm.tar.gz
Unable to install a pre-built wrtc binary; falling back to ncmake
Running ncmake configure
CMake binary could not be found. Please verify your PATH.
Running ncmake build
CMake binary could not be found. Please verify your PATH.
Built wrtc
added 811 packages in 312.982s

Failed to find binary to download (404 status code):

404 status code downloading tarball https://node-webrtc.s3.amazonaws.com/wrtc/v0.1.6/Release/node-v57-linux-arm.tar.gz

So it tries to compile it itself and since the machine is missing some configuration and libraries to tell NodeJs how to compile it:

Unable to install a pre-built wrtc binary; falling back to ncmake
Running ncmake configure
CMake binary could not be found. Please verify your PATH.
Running ncmake build
CMake binary could not be found. Please verify your PATH.

, well... nothing happens, so You end up without wrtc library.

Please let me know if my answer helped.