npm coming to Omega2+?



  • Given Omega2+ increased memory and storage, are there plans to make npm available for this more powerful device at some point?



  • Maybe this will put you in the right track right away:
    https://www.npmjs.com/package/lede

    You can replace OnionOS by LEDE if need be (with some restrictions at the moment).



  • I installed npm on my Omega2+. I connected to it via SSH and ran the following commands:

    opkg update
    opkg install npm
    

    There is also a nodejs package.



  • @fossette I don't think thats the same LEDE project as https://lede-project.org/ which I think is what you were talking about.



  • @simon
    Thanks @simon!
    //after running opkg update

    root@Omega-XXXX:/# opkg install npm
    Installing npm (v4.3.1-1) to root...
    Downloading http://repo.onion.io/omega2/packages/npm_v4.3.1-1_mipsel_24kc.ipk.
    Installing nodejs (v4.3.1-1) to root...
    Downloading http://repo.onion.io/omega2/packages/nodejs_v4.3.1-1_mipsel_24kc.ipk.
    Collected errors:
     * check_data_file_clashes: Package nodejs wants to install file /usr/bin/node
            But that file is already provided by package  * node
     * opkg_install_cmd: Cannot install package npm.
    root@Omega-XXXX:/# npm -v
    Assertion failed: (sk_num(((_STACK*) (1 ? (comp_methods) : (struct stack_st_SSL_COMP*)0)))) == (0) (../src/node_crypto.cc: InitCryptoOnce: 5482)
    Aborted
    root@Omega-XXXX:/#
    

    //so I tried nodejs - after removing node

    root@Omega-XXXX:/# opkg install nodejs
    Installing nodejs (v4.3.1-1) to root...
    Downloading http://repo.onion.io/omega2/packages/nodejs_v4.3.1-1_mipsel_24kc.ipk.
    Configuring nodejs.
    root@Omega-XXXX:/# node -v
    v4.3.1
    root@Omega-XXXX:/# npm -v
    /bin/ash: npm: not found
    root@Omega-XXXX:/# opkg install npm
    Installing npm (v4.3.1-1) to root...
    Downloading http://repo.onion.io/omega2/packages/npm_v4.3.1-1_mipsel_24kc.ipk.
    Configuring npm.
    root@Omega-XXXX:/# npm -v
    2.14.12
    

    //so it appears you need to install nodejs rather than node to get a compatible npm

    But there's then so precious little file space left to do anything! Maybe when the sdcard gets implemented that can be used??



  • @Brian-Robbins Even without the sd card working (it's a shame that there seems to be problems with this in a new product :-() there are ways you can give yourself more space using a USB memory drive:

    1. Create a swap file that will give you more virtual memory - for the Omega2 see https://docs.onion.io/omega2-docs/extending-omega-memory.html for how to do this
    2. Use the USB for storage as rootfs that will extend the disk space available - see https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs for details - while this documentation specifically relates to the original Omega, I would suspect that it would work equally well for the Omega2 (I haven't tried it myself yet for the Omega2 since I'm still waiting for it to arrive)

    Both of these techniques work well on the original Omega



  • @Kit-Bishop

    Thanks for your info. I first formatted the USB drive as EXT4, then set up the swap, then extroot with pivot-overlay (I failed at first when I tried to install the overlay then the swap), and after installing nodejs and npm:

    root@Omega-8735:/# node -v
    v4.3.1
    root@Omega-8735:/# npm -v
    2.14.12
    root@Omega-XXXX:/# free
                 total       used       free     shared    buffers     cached
    Mem:        125644      73296      52348        476       5804      44188
    -/+ buffers/cache:      23304     102340
    Swap:       524284          0     524284
    root@Omega-XXXX:/# df -k
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/root                 5632      5632         0 100% /rom
    tmpfs                    62820       476     62344   1% /tmp
    /dev/mtdblock6           25664     18928      6736  74% /overlay
    overlayfs:/overlay       25664     18928      6736  74% /
    tmpfs                      512         0       512   0% /dev
    /dev/sda1             14991780    585056  13625464   4% /mnt/sda1
    

    Wow! However.... I keep getting the following error message in attempting to npm install modules:

    npm ERR! nospc ENOSPC: no space left on device, open 'npm-debug.log.8946ac5ac8ea2c880858146fc2425020'
    npm ERR! nospc This is most likely not a problem with npm itself
    npm ERR! nospc and is related to insufficient space on your system.
    

    How can this be with all that additional memory and space? Is another step required?



  • @Brian-Robbins From the information you provide, my guess would be that you have an issue with your /etc/config/fstab file.

    After setting up the USB drive for pivot-overlay did you run block detect > /etc/config/fstab and edit the resulting /etc/config/fstab file as described in Step 4 in https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs

    If you like, you could send me or post a copy of your /etc/config/fstab file and I will take a look at it



  • @Kit-Bishop
    Thanks for helping! Here is my /etc/config/fstab:

    config global
            option anon_swap '0'
            option anon_mount '0'
            option auto_swap '1'
            option auto_mount '1'
            option delay_root '5'
            option check_fs '0'
    
    config mount
            option target '/mnt/sda1'
            option uuid 'e74b8398-1f14-44cd-b25b-d7e11f87796a'
            option enabled '1'
    
    

    and the file is "unwritable"

    root@Omega-8735:/# root@Omega-8735:/# block detect > /etc/config/fstab
    /bin/ash: can't create /etc/config/fstab: Read-only file system
    


  • @Brian-Robbins This is strange - not what I would have expected. I think there may be some relevant differences between the original Omega and Omega2 particularly in relation to the read only status of /etc/config/fstab which is a fairly important configuaration file - unfortunately I am still waiting for my Omega2 to arrive so can't test it out yet.

    In the original Omega set up for swap and pivot-overlay, there would be 2 config mount entries in /etc/config/fstab - one for the swap partition and one for the pivot-overlay partition. Also, the pivot-overlay partition should be mounted on /overlay (not /mnt/sda1)

    You could try using the following commands to change the mount point for what I believe to be you pivot-overlay partition:

    uci set fstab.@mount[0].target='/overlay'
    uci commit fstab
    

    and reboot your Omega

    But if I'm wrong, it could potentially cause problems and I am reluctant to recommended it without having tried it myself.

    Just to check what block detect thinks the fstab file should be you could just run:

    block detect > ~/fstab-check
    

    and send the resultant ~/fstab-check file for me to look at.

    If there really are significant differences with the Omega2, it would really help if the Omega devs could publish an up to date version of https://wiki.onion.io/Tutorials/Using-USB-Storage-as-Rootfs specifically for the Omega2



  • @Kit-Bishop
    Again thanks for helping.

    root@Omega-XXXX:/# block detect > ~/fstab-check
    /bin/ash: can't create /root/fstab-check: Read-only file system
    

    and pardon my ignorance, I'm used to seeing /bin/bash not bin/ash



  • @Brian-Robbins This is strange. Using:

           block detect > ~/fstab-check
    

    should have just output to a file in your home directory. Can you create files in ~/ OK? If not, there is some other issue with your system that I really don't understand. Are you sure you are logged on to your Omega as root?

    You could just try:

           block detect
    

    to output to the screen and let me know what the result is.

    FYI: /bin/ash is basically a smaller, more compact version of /bin/bash and for most basic operations operates the same



  • @Kit-Bishop
    I gave up and booted to failsafe and did a factory reset. Just doesn't seem worth the trouble. I figure I'll put this onion aside for awhile until and if the bugs get cleared up................
    Thanks for helping and your time!



  • @Kit-Bishop

    You can install bash if you wish like this:

    opkg update
    opkg install bash
    


  • @TheLion Yes - but have never really needed it :-)



  • @Kit-Bishop

    Ahh - true enough. :-) I replied to the wrong person - was supposed to be a reply to Brian..
    ash is a smaller version than bash.. There's no B in it for a start...! :-)



  • In relation to using pivot-overlay (and/or pivot-root) on the Omega2 to get more system disk space using a USB drive (or SD card?), see my recent post https://community.onion.io/topic/1295/more-system-disk-space-using-pivot-overlay-and-pivot-root-on-the-omega2


Log in to reply
 

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