setImmediate is not defined
jurafa opened this issue · comments
Hi, I am trying to use i2c library to communicate between raspberry pi and unipi and when I try to include it (var i2c = require('i2c');) I receive this error. Any idea what goes wrong?
I am installing i2c using npm.
ReferenceError: setImmediate is not defined
at Object. (/usr/share/adafruit/webide/repositories/my-pi-projects/rpi_unipi/node_modules/i2c/lib/i2c.coffee:12:10)
at Object. (/usr/share/adafruit/webide/repositories/my-pi-projects/rpi_unipi/node_modules/i2c/lib/i2c.coffee:164:4)
at Module._compile (module.js:446:26)
at Object..coffee (/usr/share/adafruit/webide/repositories/my-pi-projects/rpi_unipi/node_modules/i2c/node_modules/coffee-script/lib/coffee-script/coffee-script.js:22:21)
at Module.load (module.js:353:32)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object. (/usr/share/adafruit/webide/repositories/my-pi-projects/rpi_unipi/node_modules/i2c/main.js:2:11)
at Module._compile (module.js:446:26)
setImmediate was introduced in node v0.10. What version of node are you using? (Raspbian's repos contain a really old version, 0.6 I believe)
Does it work if the following line (from here):
tick = setImmediate || process.nextTick
is changed to:
tick = global.setImmediate || process.nextTick
Thanks for help. The version of node on repository is 0.6.x. So I updated node and all works fine.