Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Jose_N_Intel
Employee
1,205 Views

System Call to NodeJS from Arduino IDE not working any more

This was working:

system ( "node myprogram.js param1='Hello World' );

It stopped to work, presumably after I upgraded firmware.

I have also tried these:

system ( "node /home/root/myprogram.js param1='Hello World' );

system ( "/usr/bin/node myprogram.js param1='Hello World' );

Any ideas?

Tags (1)
2 Replies
Pedro_M_Intel
Employee
68 Views

Hello janunezc,

What does you're your script does? Can you share your code? I would like to test it myself.

Also, which image are you using? And which version of the Arduino IDE are you using?

Peter.

Jose_N_Intel
Employee
68 Views

I think I found the problem.

My node script does a number of things, but the simple basic operation here was not working:

var request = require('request');

var fs = require('fs');

console.log("TEST OK");

When I removed lines 1 and 2 it would work.

So it is not a problem of calling node.js.

I tried installing request module globally (npm install request -g) but it doesnt fix it.

Then I tried installing request module in the root folder (cd / ) + (npm install request)

That made it work.

So it seems that for some reason the node program remains under root folder context when I call it using a system call. My javascript is located in the /home/root/ folder; and I am calling it via system command in the Arduino Sketch

system ("node /home/root/myscript.js");

I am using the 159.devkit version.

Thanks!

--jn

Reply