apexad/node-aladdin-connect-garage-door

Still Struggling With Unexpected Token

Closed this issue · 10 comments

Can you offer any insight? I'd gladly pay to get this plugin working for me, it's the last piece of my homebridge puzzle. See below for error in terminal.

[6/25/2019, 11:17:09 AM] [Garage Door] Error: Command failed: node C:/Users/Chambers/AppData/Roaming/npm/node_modules/garage-control/state.js
C:\Users\Chambers\AppData\Roaming\npm\node_modules\node-aladdin-connect-garage-door-master\example\node_modules\node-aladdin-connect-garage-door\index.js:36
modules.export = (user, password, action, callback, deviceNumber = 0, doorNumber = 1) {
^

SyntaxError: Unexpected token {
at Module._compile (internal/modules/cjs/loader.js:718:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object. (C:\Users\Chambers\AppData\Roaming\npm\node_modules\node-aladdin-connect-garage-door-master\example\state.js:1:25)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)

at ChildProcess.exithandler (child_process.js:290:12)
at ChildProcess.emit (events.js:200:13)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {

killed: false,
code: 1,
signal: null,
cmd: 'node ' +
'C:/Users/Chambers/AppData/Roaming/npm/node_modules/garage-control/state.js'
}

Can you run ‘node’ as a command in windows? Do you maybe need to have that be the full path to node.exe? Try that

Yes, I can run it in cmd.

Make sure that state.js is valid JavaScript. Email address and username are in quotes, right?

You are sure the path is correct? Otherwise this may be a Windows issue only. I am unable to duplicate it on a raspberry pi and this issue will remain closed.

Am I supposed to enter the credentials in the state.js file or the index.js file? Can you provide and example please?

https://github.com/apexad/node-aladdin-connect-garage-door/blob/master/example/state.js
In state.js:

aladdinGarageDoor('my@email.address', 'mypasswordforaladdinxonnect', 'status', callback, 0, 1);

Quotes “ or ‘?

Double or single should not matter. One thing to confirm, you have run npm install in c:/Users/Chambers/AppData/Roaming/npm/node_modules/garage-control/

So cd to garage command, and then non install the Aladdin connect mode there?

I GOT IT!! Thanks for helping point me in the right direction. I’m not a dev or coder, but can usually hack my way through. Reinstalled the .js package and the plugin and started from scratch, after playing with the formatting of the paths I got it. Thanks.

Great! Glad you figured it out.