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.


Log in to reply
 

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