1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

node.js (v4 or later) and npm?

Discussion in 'Asuswrt-Merlin' started by kun1he2, Oct 18, 2016.

  1. kun1he2

    kun1he2 New Around Here

    Joined:
    Oct 6, 2016
    Messages:
    7
    Has anyone managed to get "node.js" and "npm" working successfully on any Asus routers, preferably the AC68U?

    I've managed to get the older node.js v0.10.29 along with npm running - unfortunately, it appears that the npm package "homebridge", which I'm trying to get running, requires a newer node.js version.

    I've also tried the node.js v6.3.1 package that is available with Optware-NG.
    Installation succeeds and "node -v" returns "v6.3.1".
    However, "npm -v" returns "Illegal instruction" error.

    Perhaps the binaries were compiled with hard float option? Or perhaps the kernel used by Asus is too old?
     
  2. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    31,194
    Location:
    Canada
  3. kun1he2

    kun1he2 New Around Here

    Joined:
    Oct 6, 2016
    Messages:
    7
  4. zyxmon

    zyxmon Regular Contributor

    Joined:
    Feb 9, 2015
    Messages:
    167
  5. kun1he2

    kun1he2 New Around Here

    Joined:
    Oct 6, 2016
    Messages:
    7
    Thanks, looking forward to it!

    Btw, not sure if it helps, but the node v6.3.1 package from Optware-NG which fails with "Illegal instruction" shows the following for "node --v8-options":

    target arm v7 vfp3 softfp
    ARMv8=0 ARMv7=1 VFP3=1 VFP32DREGS=1 NEON=0 SUDIV=0 MLS=1UNALIGNED_ACCESSES=1 MOVW_MOVT_IMMEDIATE_LOADS=0 COHERENT_CACHE=0 USE_EABI_HARDFLOAT=0
     
  6. zyxmon

    zyxmon Regular Contributor

    Joined:
    Feb 9, 2015
    Messages:
    167
    You are right - although readelf shows node binary is a softfloat exacutable - it fails with "Illegal instruction". There will be two node packages for armv7 - a legacy one for softfloat arch and 6.7 for hardfloat arch.
     
  7. kun1he2

    kun1he2 New Around Here

    Joined:
    Oct 6, 2016
    Messages:
    7
    Thanks, looks like all ASUS routers will only be able to use the legacy softfloat arch v0.10.x?
     
  8. zyxmon

    zyxmon Regular Contributor

    Joined:
    Feb 9, 2015
    Messages:
    167
    Yes. Right.
     
  9. DonChino

    DonChino Occasional Visitor

    Joined:
    Dec 21, 2016
    Messages:
    10
    Ok? So how exactly do you install NPM and/or Node.JS onto entware-ng on the ASUS RT-AC68U?!

    I do not see any details here... :confused:
     
  10. swetoast

    swetoast Guest

    Joined:
    Apr 12, 2016
    Messages:
    804
    Last edited: Mar 29, 2017
  11. DonChino

    DonChino Occasional Visitor

    Joined:
    Dec 21, 2016
    Messages:
    10
    Some of us are a little "lazy" and just browse via mobile looking for "shortcuts" while we work on other things, so I will help the other lazy slobs who already have entware-ng installed, such as myself.

    Turns out that node.js is already in entware-ng - https://pkg.entware.net/binaries/armv7/Packages.html

    Install command:
    opkg install node

    Check Node:
    node -v --> Response: v6.7.0

    Check NPM:
    npm -v --> Response: Illegal Instruction

    That is the HARDFLOAT version, meanwhile you can install the SOFTFLOAT version:

    Install command:
    opkg install node_legacy

    Check Node:
    node -v --> Response: v0.10.46

    Check NPM:
    npm -v --> Response: Segmentation Fault

    I guess we have "buggy" or handicapped installers, but neither has a working installation of NPM so if someone knows how to get ANY version of NPM installed onto entware-ng (with instructions) that would be helpful. I know kun1he2 is after "homebridge", but there are other packages we might be able to use that do not require the "new" stuff, so maybe he can share how he installed a working version of NPM... ;)

    Quick Spec Check:
    Router: RT-AC68U
    rmerlin: 380.65

    Bonus Questions:
    entware-ng: ?How do we check what version we have? Also, how do we update our entware-ng install?

    *now crawl this Google*

    :confused:
     
    Last edited: Mar 31, 2017
  12. kvic

    kvic Part of the Furniture

    Joined:
    Aug 11, 2014
    Messages:
    2,444
    Location:
    22.4399N 114.2222E
    softfloat != works on ARM without HW FP.

    Not sure about "latest/greatest" Asus, no hope to run v6 on RT-AC88U and older models. You can try v0.10.

    Another problem is that 256MB or even 512MB RAM is not sufficient to compile NPM packages. Is there a cross compilation tool available? I'm not so sure. Your other hope is to get it compiled on a compatible ARMv7 with more RAM, and transplant the NPM packages to run on Asus router with v0.10.

    I have been running my Kazoo It! blog on node.js v0.10 with a 128MB RAM x86 machine. So it's possible. In my case, it fulfils my need well.
     
  13. zyxmon

    zyxmon Regular Contributor

    Joined:
    Feb 9, 2015
    Messages:
    167
    Thanks for reporting - 0.10.46 segfaults. Please use 0.10.44
    Code:
    [email protected]:/tmp/home/root# cat /proc/cpuinfo
    Processor       : ARMv7 Processor rev 0 (v7l)
    processor       : 0
    BogoMIPS        : 1599.07
    
    processor       : 1
    BogoMIPS        : 1595.80
    
    Features        : swp half thumb fastmult edsp
    CPU implementer : 0x41
    CPU architecture: 7
    CPU variant     : 0x3
    CPU part        : 0xc09
    CPU revision    : 0
    
    Hardware        : Northstar Prototype
    Revision        : 0000
    Serial          : 0000000000000000
    [email protected]:/tmp/home/root# node -v
    v0.10.44
    [email protected]:/tmp/home/root# npm -v
    2.15.0
    
    To install the old version from archive -
    Code:
    [email protected]:/tmp/home/root# opkg remove node_legacy
    Removing package node_legacy from root...
    [email protected]:/tmp/home/root# wget http://pkg.entware.net/binaries/armv7/archive/node_legacy_v0.10.44-1_armv7soft.ipk
    Connecting to pkg.entware.net (81.4.123.217:80)
    node_legacy_v0.10.44 100% |*****************************************************************************|  3957k  0:00:00 ETA
    [email protected]:/tmp/home/root# opkg install node_legacy_v0.10.44-1_armv7soft.ipk
    Multiple packages (node_legacy and node_legacy) providing same name marked HOLD or PREFER. Using latest.
    Installing node_legacy (v0.10.44-1) to root...
    Configuring node_legacy.
    
     
  14. zyxmon

    zyxmon Regular Contributor

    Joined:
    Feb 9, 2015
    Messages:
    167
    I have upgraded node_legacy to 0.10.48 - it does not segfault!
     
  15. sfx2000

    sfx2000 Part of the Furniture

    Joined:
    Aug 11, 2011
    Messages:
    14,225
    Location:
    San Diego, CA
    Most of the ARM development these days on small ARM's is for hardfloat (armhf) - the FPU is optional in Cortex-A9. Not saying that A9 is slow, just need to take this into consideration in your buildroot config. The buildroot in RMerlin's has this already in place.

    Node and NPM is very tight on an 256MB machine, even on a 512MB machine - it'll run, but not very well - might consider running things on another machine - Pi3 runs Node.JS, NPM, and many other similar items very well, and can complement your current Router*...

    * Pi3 - mostly due to more RAM and possible storage, and Cortex-A53 there is pretty good...
     
  16. BelarusOK

    BelarusOK Occasional Visitor

    Joined:
    Oct 1, 2018
    Messages:
    17
    Location:
    Russia
  17. BelarusOK

    BelarusOK Occasional Visitor

    Joined:
    Oct 1, 2018
    Messages:
    17
    Location:
    Russia
    Code:
    [email protected]:/tmp/home/root# opkg install node
    Installing node (v8.16.0-2) to root...
    Downloading http://bin.entware.net/armv7sf-k2.6/node_v8.16.0-2_armv7-2.6.ipk
    Installing libnghttp2 (1.38.0-1) to root...
    Downloading http://bin.entware.net/armv7sf-k2.6/libnghttp2_1.38.0-1_armv7-2.6.ipk
    Installing libuv (1.24.1-1) to root...
    Downloading http://bin.entware.net/armv7sf-k2.6/libuv_1.24.1-1_armv7-2.6.ipk
    Installing libhttp-parser (2.9.2-1) to root...
    Downloading http://bin.entware.net/armv7sf-k2.6/libhttp-parser_2.9.2-1_armv7-2.6.ipk
    Configuring libnghttp2.
    Configuring libhttp-parser.
    Configuring libuv.
    Configuring node.
    ======
    [email protected]:/tmp/home/root# opkg install node-npm
    Installing node-npm (v8.16.0-2) to root...
    Downloading http://bin.entware.net/armv7sf-k2.6/node-npm_v8.16.0-2_armv7-2.6.ipk
    Configuring node-npm.
    ======
    [email protected]:/tmp/home/root# npm install -g homebridge
    /opt/bin/node: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
    [email protected]:/tmp/home/root# error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
    ======
    opkg upgrade
    Removing obsolete file /opt/lib/libssl.so.1.0.0.
    Removing obsolete file /opt/lib/libcrypto.so.1.0.0.
    # UPDATED to libcrypto.so.1.1
    ======
    [email protected]:/tmp/home/root# npm install -g homebridge
    Illegal instruction
    Probably have to buy Raspberry Pi :(
     
  18. sfx2000

    sfx2000 Part of the Furniture

    Joined:
    Aug 11, 2011
    Messages:
    14,225
    Location:
    San Diego, CA
    Node is problematic - not just on embedded ARM, but also MIPS - it can run, but one needs to compile pretty much everything for the platform it's being used on.

    RPi supports this out of the box with Raspbian...
     
  19. zyxmon

    zyxmon Regular Contributor

    Joined:
    Feb 9, 2015
    Messages:
    167
    New node versions for arm require hardfloat hardware support. 0.10.xx is the last version, that can be compiled for arm without hard float.