Ruuvitag js module not working

I’ve been trying to use the Espruino firmware on my Ruuvitag and I’ve also seen several examples that use the require(‘Ruuvitag’) feature.

However, whenever I try anything that uses the Ruuvitag module I just get errors.

Uncaught SyntaxError: Got ID:LIS2DH12 expected ‘,’
at line 1 col 531
…a,14),d(Modules.addCached(“LIS2DH12”,“function f(c,a,d){this…
return exports.env.getData()};\nexports.getAccelData=function(a){return exports.accel.getXYZ()}”);
Uncaught ReferenceError: “exports” is not defined
at line 1 col 15
return exports.env.getData()};\nexports.getAccelData=functio…

I am using the EspruinoHub on my Raspberry Pi with the Web IDE.

Maybe there is some issue with the EspruinoHub? I’ve not had problems when developing with Web IDE on a PC

I have exactly the same problem. Flashed the cutting-edge-build (1v99) firmware over Web IDE. But as soon as I try to access the accelerometer, it crashes with the same error msg as Cheney got. Blinking leds ie. basic stuff is working well.


Can you show the Espruino console log? You can find the log under settings, settings can be accessed through gear icon in upper right corner.


Here’s my program + log:

var Ruuvitag = require(“Ruuvitag”);
var on = false;
setInterval(function() {
on = !on;
// prints { “temp”: 23.70573815741, “pressure”: 1017.27733597036, “humidity”: 42.0771484375 }
}, 1500);

My console log seems pretty similar to yours, although I’m on 1.99. I’m running the Espruino IDE on Mac OSX / Chrome.

Could you try my program?

Hmm, weird. I updated to 1.99 and tried your program on Espruino IDE OSX / Chrome. This time a bunch of other errors as well:

Can you try with another RuuviTag or with a fresh battery?
ERROR: [notify_error] Prompt not detected - upload failed. Trying to recover...
sounds like the Espruino would crash on RuuviTag :thinking:

I increased your trust level on forum, hopefully you should be able to send the links from now on. Please ping me at if you have further issues with posting

Thanks Otso,
as it seems this was a problem with Espruino Web IDE and it’s now solved.
See here for more info:

1 Like

thanks! looking good.