koalazak / dorita980

Unofficial iRobot Roomba and Braava (i7/i7+, 980, 960, 900, e5, 690, 675, m6, etc) node.js library (SDK) to control your robot
MIT License
945 stars 150 forks source link

Use of const in strict mode #9

Closed mcmurm closed 7 years ago

mcmurm commented 7 years ago

First, nice job on this library. Looks very promising. Here's one issue I ran into that might help others exploring your work. I'm not an expert, but I think this is due to versioning difference in node.js?

hass@sob:~/roomba/dorita980$ node ./bin/getpassword.js "..."

/home/hass/roomba/dorita980/bin/getpassword.js:3 const request = require('request'); ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3

Fixed by using the --harmony node.js switch:

hass@sob:~/roomba/dorita980$ node --harmony ./bin/getpassword.js "..." Make sure your robot is on the Home Base and powered on (green lights on). Then press and hold the HOME button on your robot until it plays a series of tones (about 2 seconds). Release the button and your robot will flash WIFI light. Then wait and look here... ========> Good job! Password: * Username/blid: *** Use this credentials in dorita980 lib :)

koalazak commented 7 years ago

hi, what node version you have?

On Dec 29, 2016, at 18:25, mcmurm notifications@github.com wrote:

First, nice job on this library. Looks very promising. Here's one issue I ran into that might help others exploring your work. I'm not an expert, but I think this is due to versioning difference in node.js?

`hass@sob:~/roomba/dorita980$ node ./bin/getpassword.js ""

/home/hass/roomba/dorita980/bin/getpassword.js:3 const request = require('request'); ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3 `

Fixed by using the --harmony node.js switch:

hass@sob:~/roomba/dorita980$ node --harmony ./bin/getpassword.js "" Make sure your robot is on the Home Base and powered on (green lights on). Then press and hold the HOME button on your robot until it plays a series of tones (about 2 seconds). Release the button and your robot will flash WIFI light. Then wait and look here... ========> Good job! Password: * Username/blid: *** Use this credentials in dorita980 lib :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mcmurm commented 7 years ago

hass@sob:~/roomba$ node --version v0.10.25

koalazak commented 7 years ago

dorita980 is not compatible with node < 4.0. Tests are passing ok for node 4, 5, 6 and latest. Basicaly, dorita980 use Promises and they are introducing on node 0.12

const are supported in node 0.10 but with harmony flag.

I will update the readme for 0.10 users to advise about harmony flag only for getpassword.js file (the rest of dorita980 may not work anyaway cos promises)

thanks!

koalazak commented 7 years ago

pushed in https://github.com/koalazak/dorita980/commit/7f52888e6a9aa9440fed41e322e66f099236da7b

mcmurm commented 7 years ago

Awesome, thanks, and good work.

mcmurm commented 7 years ago

FYI, I updated to node 6.x and everything is working fine. This also fixed rest980 (wouldn't run under node .10...) Thanks again.