maxinminax / node-mihome

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
MIT License
121 stars 35 forks source link

Syntax error #9

Closed dottoreFell closed 3 years ago

dottoreFell commented 3 years ago

Hello, first of all, I am going back to programming after a while so forgive me if I am missing something obvious (and I probably am).

So I am trying to use this new lib instead of miio that I used before. I'd love to have functionality like being able to get tokens from cloud, etc., but when I am trying to use it I am getting an error.

const mihome = require('node-mihome'); mihome.miioProtocol.init();

`C:\Users\Michal\source\ihome\ihome_api\node_modules\node-mihome\lib\devices\imibar.cooker.mbihr3.js:26 static model = 'imibar.cooker.mbihr3'; ^

SyntaxError: Unexpected token = at new Script (vm.js:80:7) at createScript (vm.js:274:10) at Object.runInThisContext (vm.js:326:10) at Module._compile (internal/modules/cjs/loader.js:664:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18)`

0x2206 commented 3 years ago

What is Node.js version you use? You can check it e.g. via node --version terminal command.

EDIT: Paste npm version as well, please. npm --version in terminal.

dottoreFell commented 3 years ago

Hey, old Node.js version was the reason, the problem occured on: Debian - npm -v 5.8.0 node -v v10.15.2

Windows - npm -v 6.4.1 node -v v10.15.3

After upgrading to current LTS it is working fine now, big thanks!

0x2206 commented 3 years ago

That's what I suspected. I'm glad it was so easy :-)

dottoreFell commented 3 years ago

I am glad too, I like this library more and more as I am using it :).