We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Does node.js not include packages in opkg yet?



  • Hey @Theodore-Borromeo it worked/downloaded with the command

    docker pull borromeotlhs/docker-onion-omega-nodejs:v1

    Sweet.

    Weird that docker said that it was a legacy repository.

    I can't manage to get into the container. I am trying this command from the docker file:

    docker run -d --net=none --expose=[9000] -p 127.0.0.1:9004:9000 -t alljoyn-builder:production

    (file says sudo, but not sure if you would need to)

    For some reason I keep getting a "no matches found: --expose=[9000]" which is weird. I am wondering if it is something with my docker setup - I am using zsh not bash. I just got started with docker, and the examples all worked, but I can't launch this one.



  • @Chris-Ward you can run the image you pulled with:
    docker run -it borromeotlhs/docker-onion-omega-nodejs:v1 /bin/bash

    you pulled one image, and tried to run an older image via a tag that you may not have. I also tend not to bother with a daemon for build toolchains, but that's just me πŸ˜‰



  • Yes @Theodore-Borromeo I got it running. I was just trying to follow the suggestion from the docker file. I don't get what they were trying to get at. I managed to get to a bash prompt with pretty much the same command as above. I looked around, saw how you compiled, but haven't had a chance to do anything else yet.



  • @Chris-Ward yeah, apologies that the comments from within the Dockerfile were from a previous project, and thus had 'hints' for myself when I first started using docker. Coincidentally, alljoyn for the wndr3700 πŸ™‚ alljoyn, if it were useful or more widely adopted might be a great lib for the omega if it had bt. . .



  • So what is the status of this? Will we always need a usb stick connected to our onion in order to use Node.js?



  • @Stephen-Tunney With node version 0.10.5, it only takes up around 3 MB of space. So you should be able to run it entirely on the Omega's flash.



  • @Dan-L. are you still working on porting Samsung's IOT.js?





  • @Boken-Lin

    anything to report? πŸ™‚



  • is it even possible to get npm running?

    related, It might be worth contacting the NodeJS foundation to see if Onion can help them add better MIPS support. If Onion were able to donate a few Omegas, it'd surely go a long way.



  • @Fred-Blais Not yet, unfortunately... But we won't stop until it's done! Getting Javascript support is something we've promised, and we'll deliver it in both Node.js and IoT.js πŸ™‚

    @Christopher-Hiller Yes, npm is very doable. The only hard part is the node-gyp stuff which compiles non-Javascript source to binary (because Omega doesn't have a huge amount of computing power), but our solution to that is to build a npm repo with pre-compiled modules that can be just installed with npm.



  • Is there any way to cross compile node addons for MIPS because if i compile it with Ubuntu 15.10 it says that my addon dont has a correct ELF Header.
    Im pretty much done porting the fast-gpio lib to node.js but i have this error weile requiring it.



  • @Philipp-Czarnetzki Can you walk us through how you are compiling the module?



  • @Boken-Lin: Sure, i'd love to! πŸ˜„
    First my Specs:

    Asus Zenbook (ux32a)
    Ubuntu 15.10 64bit (just a fresh install for the cross compiling, build-essential, gcc & etc preinstalled)

    Well i thought i can make a wrapper for "fast-gpio" using Windows 7 64bit but then i saw that it requires unix only headers.
    Hmmm, ok, just for this i have made a clean install of ubuntu 15.10 on my laptop, installed node and npm and installed node-gyp.
    I ported most of the code on my Windows PC and copied all to my laptop and compiled it with node-gyp.
    Here my gyp file:

    {
        'targets': [
            {
            'target_name': 'gpio',
            'sources': [ 'src/gpio.cpp' ],
            'include_dirs': [ 'inc' ]
            }
    }
    

    And a screen of the error:
    Error

    Here is also the readelf log:

    > readelf -h gpio.node
    ELF-Header:
      Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
      Class:                            ELF64
      Data:                             2er-Komplement, Little-Endian
      Version:                           1 (current)
      OS/ABI:                            UNIX - System V
      ABI-Version:                       0
      Type:                               DYN (splitted Objektafile)
      Maschine:                          Advanced Micro Devices X86-64
      Version:                           0x1
      Entry point address:               0xc30
      Begin of Program-Header:          64 (Bytes in File)
      Begin of Sektions-header:          11376 (Bytes in File)
      Flags:                             0x0
      Size of Headers:              64 (Byte)
      Size of the Program-Header:         56 (Byte)
      Number of program headers:         7
      Size of Sektions-Header:         64 (bytes)
      Count of Sektions-Header:        27
      Sektions-Header Stringtabellen-Index: 24
    
    

    Thats pretty much it.
    Greetings from Germany!



  • @Boken-Lin said:

    @Fred-Blais Not yet, unfortunately... But we won't stop until it's done! Getting Javascript support is something we've promised, and we'll deliver it in both Node.js and IoT.js πŸ™‚

    Have a look at this document : http://www.soscon.net/download/day28/GB2/S_28_1050_μ΄μΆ˜μ„.pdf

    It looks to me that IoT.js is a much more logical choice than Node.js on the Omega
    JerryScript takes anywhere from 100-300kb depending on the install, the V8 javascript engine takes about 10MB.
    10MB is a lot on a 16MB device... IoT.js is also Node compatible.



  • @Philipp-Czarnetzki Seems like you are trying to compile the module for x86-64? Did you set up the cross-compile environment for Omega? node-gyp by default compiles the module for the machine you are running it on. In order to use it to compile for the Omega, you will need to tell node-gyp to compile using the Omega toolchain. You can download the Omega toolchain from here: https://s3-us-west-2.amazonaws.com/onion-cdn/community/openwrt/OpenWrt-Toolchain-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2.



  • @Fred-Blais Yes, I totally agree that IoT.js is a much better choice for embedded platforms like the Omega. I wish we had heard about it earlier πŸ™‚ Also, thanks for the link to the document. It provides quite a bit of useful information.



  • @Boken-Lin How Do I do this?



  • @Philipp-Czarnetzki Have you looked at our wiki article on setting up the cross-compile environment for the Omega? If not, it's here: https://wiki.onion.io/Tutorials/Cross-Compile. Once you have that setup, you need to setup the environment variables like CC and CXX to point node-gyp to the compiler for cross compilation. To compile you will need to use node-gyp --arch mips configure build, however, bear in mind that most modules out there probably don't have MIPS architecture support designed, you might need to manually port over some stuff if you see some error during your compilation.



  • @Boken-Lin I have compiled my module for MIPS Arch but now i get a "File not found" Error from node if i want to require it.

    root@Omega-XXXX:/mnt/sda1/test/build/Release# node`
    > var hello = require('./hello')
    Error: File not found                                                                                                                                                                         
        at Module.load (module.js:356:32)                                                                                                                                                         
        at Function.Module._load (module.js:312:12)                                                                                                                                               
        at Module.require (module.js:364:17)                                                                                                                                                      
        at require (module.js:380:17)                                                                                                                                                             
        at repl:1:13                                                                                                                                                                              
        at REPLServer.self.eval (repl.js:110:21)                                                                                                                                                  
        at repl.js:249:20                                                                                                                                                                         
        at REPLServer.self.eval (repl.js:122:7)                                                                                                                                                   
        at Interface.<anonymous> (repl.js:239:12)                                                                                                                                                 
        at Interface.EventEmitter.emit (events.js:95:17)   
    

Log in to reply
 

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