Time to Expand your Yún disk space and install Node.js

Zoe RomanoMay 6th, 2014

ArduinoYun

Following the announcement of the new Yún image, we are happy to announce two new features of the Arduino Yún.

  • The first feature allows you to use a micro SD card as a replacement for the Yún’s internal flash memory. We have a tutorial that demonstrates how using this expands your Yún’s free disk space from the original 7 Megabytes to the available Gigabytes of your SD card.

Having more disk space allows you to make more complex projects, like activating webcams and saving pictures taken with it. In addition, by using an external SD card you avoid using the internal flash memory, thus extending the life of your Yún.

To upgrade your Yún to access this feature, follow the tutorial. Report back to the Arduino Yún forum if you have any issues or questions.

  • The second new feature is the availability of Node.js as an installable package.

In order to install Node.js on your Yún, use the Arduino IDE to upload the YunSerialTerminal example or access your Yún via SSH.

Be sure your Yún has access to the internet, then type the following commands:

opkg update
opkg install node

And voilà! You’ve got Node.js on your Yún.

Try it out with the following command: 

node -e "console.log('Hello_Yun')"

If you are a Node.js fan, you probably want to use your favourite modules. Unfortunately, not every Node.js module is “pure javascript”, so some modules won’t work on the Yún. We are solving this by preparing packages for the most common native Node.js modules. We have already prepared node-serialport (opkg install node-serialport) and noble is on the way. If you miss your favourite module and want it added to the list, please consider joining us in developing the Yún.

15 Responses to “Time to Expand your Yún disk space and install Node.js”

  1. chiari-show Says:

    Try this code:

    var crypto = require(‘crypto’);
    var name = ‘I love Node.js';
    var hash = crypto.createHash(‘md5′).update(name).digest(“hex”);
    console.log(hash);

    It will gives you the wrong hash.

    Two things:

    1) Why do you use dm-dev-mipsbe instead of dm-mipsbe-3.14 that is better?

    2) If you are interested I made a fix (a small change in the nodejs source code) for the hashes bug.

  2. iamwin Says:

    is there a procedure to revert? I would like to adjust the space that I initially alloted :) thanks in advance!

  3. thathollywood Says:

    Is this not still installing to the flash?
    Have I missed a step to install Node to the SD card, as I’ve already run out os space.

  4. chiari-show Says:

    Guys, it’s easy! just copy the node files in your sd and make a soft link.

  5. Federico Fissore Says:

    @chiari-show, I missed that branch! I’m going to update v8 in the coming days

  6. chiari-show Says:

    No problem! When I have time I will clone the actual nodejs source in my github and insert the hashes fix. If you want I let you know when.

  7. Federico Fissore Says:

    It would be great if you can contribute with a patch or better a pull request on our github repo http://is.gd/dQfPno

  8. angeldimitrov Says:

    Hello Together,
    Is there already a way to install the serialport node.js module thru
    opkg?

    opkg install node-serialport

    does not find any packages matching node-serialport

    Thank you

  9. DavidMJBos Says:

    Hi angeldimitrov
    I think you have to use npm install node-serialport

  10. DavidMJBos Says:

    Sorry did you do opkg update before opkg install …?

  11. angeldimitrov Says:

    @DavidMJBos
    1) npm install node-serialport
    does not work, the right package name is serialport and i it can not be compiled on the Yun;
    2) yes i did opkg update before trying to install it.

    Did anyone had success installing this package?

  12. biosbob Says:

    are there any updates on that “hashes fix” mentioned earlier??? i may have encountered a node-ws issue that could be impacted by this

  13. bast64 Says:

    Hi,
    I have a bug with npm install express after the installation of node.js on the Yun:
    FATAL ERROR: Evacuation Allocation failed – process out of memory
    Aborted
    Do you know what I can do for that ?

  14. angeldimitrov Says:

    @bast64 – did you activate the swap partition? In my case this was the solution. Otherwise i was not able to compile the node modules.

  15. alessandro_montanari Says:

    @biosbob, are you getting “invalid server key” if you try to open a WebSocket between the Yun and a computer?

Leave a Reply

You must be logged in with your Arduino account to post a comment.