Search code examples
linuxnode.jsserial-portarduinoopenwrt

Linino (openWRT) on arduino Yun & nodejs - Nodejs Serial module not working


I'm using my arduino yun board to try a protocol I've made to control a robot I'm making using arduino.

The same job, using a raspberry pi for the previous project, worked pretty well and I had no issues with anything at all.

Basically, my environment WAS:

Aaaand I had literally no problems, but since I was very confident with the arduino yun board, I decided to try doing basically the same thing but, instead of using my raspberry pi, I wanted to use only my arduino yun board.

After correctly configuring the arduino yun board, compiling, and installing nodejs following this guide, I correctly can run node:

enter image description here

Cool.

Now, npm, unluckily doesn't work (as expected from the above tutorial):

enter image description here

Since npm is not working, I proceded this way:

Under /www/, I've made a directory called "nodejsTEST":

cd www
mkdir nodejsTEST

accessed it, and made a pretty basic server.js file:

enter image description here

The above code works perfectly, and by accessing at arduino.local/nodejsTEST it actually outputs "Ohay :)".

Now, next step:

I downloaded the same library I was using on the raspberry pi:

https://github.com/voodootikigod/node-serialport

and, since I can't use npm, I've copied it to the nodejsTEST folder but, when I'm requiring it from nodejs (I've looked around here in stackoverflow about how to include it correctly) keeps telling that some modules are missing, suchs as this one:

enter image description here

I've tried downloading the module itself but it doesn't work at all, so what I was wondering is where all the modules were stored, since there usually is a /usr/local/bin/node folder.

Surprisingly, there literally is no trace about node.

Even by printing its path and trying to access it, it's telling me the path does not exists:

enter image description here

Any idea of how to solve this issue? I'm really looking forward to be able to use the serial port library with nodejs, since I had a really positive experience on my previous project both from the point of view of the performance and from the point of view of its stability.

Thanks.


Solution

  • After looking around for (quite long) while, I came up with this link:

    http://blog.arduino.cc/2014/05/06/time-to-expand-your-yun-disk-space-and-install-node-js/

    Which actually allows you to use your external SD card as available space either for linino and for storing basicly anything and, moreover, it actually even allows you to install both Nodejs and the Nodejs-serialport module.