NodeJS version 6+ ?



  • Has another ported over NodeJS version 6.0 or higher yet for the MIPS / Onion environment?

    Thanks



  • I am using this makefile for node v8.9.4 without any additional patches.

    include $(TOPDIR)/rules.mk
    
    PKG_NAME:=nodejs
    PKG_VERSION:=v8.9.4
    PKG_RELEASE:=1
    
    PKG_SOURCE:=node-$(PKG_VERSION).tar.gz
    PKG_SOURCE_URL:=https://nodejs.org/dist/${PKG_VERSION}/
    
    PKG_BUILD_DIR:=$(BUILD_DIR)/node-$(PKG_VERSION)
    PKG_BUILD_PARALLEL:=1
    PKG_BUILD_DEPENDS:=
    PKG_USE_MIPS16:=0
    
    include $(INCLUDE_DIR)/package.mk
    
    define Package/nodejs
      DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +zlib
      SUBMENU:=Node.js
      SECTION:=lang
      CATEGORY:=Languages
      TITLE:=Node.js v8.9.4
      URL:=https://nodejs.org/
    endef
    
    define Package/nodejs/description
    Event-driven I/O server-side JavaScript environment based on V8
    endef
    
    define Package/npm
      DEPENDS:=+nodejs
      SUBMENU:=Node.js
      SECTION:=lang
      CATEGORY:=Languages
      TITLE:=Node.js Package Manager
      URL:=https://npmjs.org/
    endef
    
    DEST_CPU=$(ARCH)
    
    
    
    CONFIGURE_ARGS = --dest-cpu=$(DEST_CPU) --dest-os=linux \
      --shared-openssl --shared-openssl-includes="$(STAGING_DIR)/usr/include" --shared-openssl-libpath="$(STAGING_DIR)/usr/lib" \
      --shared-zlib --shared-zlib-includes="$(STAGING_DIR)/usr/include" --shared-zlib-libpath="$(STAGING_DIR)/usr/lib" \
      --with-intl=none \
      --v8-options="--max_old_space_size=30 --initial_old_space_size=4" --without-snapshot
    
    
    CONFIGURE_ARGS += \
    --with-mips-arch-variant=r2 --with-mips-fpu-mode=fp32 --with-mips-float-abi=soft
    
    
    define Package/nodejs/install
    	mkdir -p $(1)/usr/bin
    	$(INSTALL_BIN) $(PKG_BUILD_DIR)/out/Release/node $(1)/usr/bin/node
    endef
    
    define Package/npm/install
    	mkdir -p $(1)/usr/lib/node_modules
    	$(CP) $(PKG_BUILD_DIR)/deps/npm $(1)/usr/lib/node_modules
    	mkdir -p $(1)/usr/bin
    	ln -sf /usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/bin/npm
    endef
    
    $(eval $(call BuildPackage,nodejs))
    $(eval $(call BuildPackage,npm))
    

    However, node v8 uses builtin inspector for debugging purposes. That inspector depends on icu module and the icu is quite big - full is 22,5 MB, small ~8MB (as far as I can remember). I wasn't able to compile node with small-icu and full-icu is too big for the omega. I end up using node without debugging features temporarily.

    Reference to NodeJS configure script:
    https://github.com/nodejs/node/blob/master/configure#L1406

      disable_inspector = (options.without_inspector or
                           options.with_intl in (None, 'none') or
                           options.without_ssl)
      o['variables']['v8_enable_inspector'] = 0 if disable_inspector else 1
    


  • @Arek-Z Hello, can you please provide a bit more info on how this Makefile works? I am trying to use it with Node.js 8.11.1. I downloaded the source code from https://nodejs.org/dist/v8.11.1/node-v8.11.1.tar.gz and extracted it on my Omega2+. I then installed python and gcc. I put your Makefile (with the PKG_VERSION changed to v8.11.1) in the root directory, ran ./configure, and then make, but I got an error saying package.mk: No such file or directory. Would you be able to help me get this working?



  • Forget totally about compiling it on the omega. You have to cross compile it using this repo: https://github.com/OnionIoT/source.



  • Hi @Arek-Z , i try to compile nodejs 8.9.4 using cross compile and editing the Makefile from /source/packages/feeds/onion/nodejs,

    when i try the command from /source: make -j1 V=s /package/nodejs i have an error:

    {standard input}: Assembler messages: {standard input}:125: Error: opcode not supported on this processor: mips32r2 (mips32r2) `ldc1 $f0,24($fp)'

    my file ".config" in /source is the some from OnionIoT git source.

    What i'm doing wrong?



  • Hi @Arek-Z can you share you bin of node v 8.9.4 ? Or help me and @Jorge-Garcia how to cross compile the node v8.x with docker from this repo: https://github.com/OnionIoT/source
    thank you very much.



  • @Jorge-Garcia Hi i have same error when i create config with: ./configure --without-snapshot --with-mips-float-abi=soft
    if i create config without the argument --with-mips-float-abi=soft build node successful but not work correct for float operation
    (I know the config create hardware float for cpu but cpu only have software float... and this is the problem for float operation)

    example.js:
    var a = 0.1;
    var b = 0.4;
    var c = a + b;
    console.log(c);
    and run: ./node example.js

    I have error:
    Fatal error in , line 0
    unreachable code
    node v4.3.1 on omega run this example.js correct.

    any idea how to fix the problem ? thx sorry for my English.



  • I had someone make me 2 versions of node. v8 and v9. I am using v8 successfully for a while now. I also had upgraded the npm.

    https://www.dropbox.com/s/skm0d51ou4yqnqt/node_v8.11.3-2_mipsel_24kc.ipk?dl=0

    https://www.dropbox.com/s/nuyvqo3rtkxhab2/node-npm_v8.11.3-2_mipsel_24kc.ipk?dl=0

    Let me know how you like it, install it using opkg.



  • @brolly759 I will definitely try, thank you for sharing.
    Edit: @brolly759 your node works fine. I have question you node v8.11.3 use 13.7MB disk space, my compiled node v8.10.0 is compile with this configure args: --with-intl=none --without-snapshot --with-mips-float-abi=soft and use 25.4MB of disk space. You can share you configure for build node, my node is two times bigger than your's ...?
    @Jorge-Garcia I have also solved the problem of the error message and now I am able to compile the node v8 which works correctly, I still have to do some tests and write here a detailed procedure for compiling the node



  • Thank you very much for the contribution @brolly759 and @MFsoft , I'll try it and I'll tell you how it was, I needed this version to install the latest version of node-red and some google-home repositories.

    @MFsoft , I look forward to the detailed procedure to compile my own version


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.