Clean NPM and NodeJS functionality on Yun

Hi,

I would like to use NodeJS and the NodeJS usual packages (serialport, firmata, express, etc...) on a Yun. Especially I would like to use directly the MCU in interface with my Node scripts using the StandardFirmataYun sketch on the MCU and the firmata and cylon-firmata modules in NodeJS.

I read several interesting web sites among them :
GitHub - serialport/node-serialport: Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!,
http://cylonjs.com/,
Node.js on Arduino Yún - AppSaloon,
and some others.

In any case they recommend to pre install on a computer all the needed packages and/or to cross compile libraries before installing on the Yun.

Based on my short experience of NodeJS, I would prefer to use npm install command in my app folder with the package.json file to install directly all the needed node_modules. Or I would like to install node packages on the Yun for use with my script not in command line (not globally installed). ta To avoid any memory issues that are frequently reported, I used a SD card, I expanded the disk as presented on the arduino.cc website and I created a swap file. In the end, everything is working fine with the exception of two things:

1 - I can only install "anywhere" the node modules globally, or I can install them in a node_modules directory using npm if it i in a subfolder of root, otherwise, for instance in arduino under /mnt/sda1, npm loads the modules from the web but states that I should run npm in root/Administrator mode and closes the task with a lot of errors... As I am root and as in OpenWRT I cannot sudo any actions, I don't know what I can do to workaround this issue. Do you have any idea to extend the npm authorization to anywhere for the root?

2 - On the specific case of the serialport module, each time I try to npm install it, it seems that there is a problem with node-pre-gyp (fallback-to-build). When I try it using Node on my windows machine, I have the same behavior but in the end it succeed in installing the module.
It exists a node-serialport opkg package but I don't know where it drops my module. When I install firmata or cylon-firmata they encounter issues also with the serialport dependency. Does someone succeed in installing that module?

Thanks

AtoM

Node need a lot of memory plus CPU power, The Yun/Yun shield is not ideal platform for it.
Wait replace with powerful hardware to support it well.

Looks like you need a Raspberry, or either change NodeJS for Flask (light-weight python framework) + Bridge instead of firmata.