andrehaveman / spotify-node-applescript

Control Spotify on Mac OSX with NodeJS and AppleScript
MIT License
316 stars 38 forks source link

TypeError: Cannot read property 'state' of getState #31

Open Alutun opened 7 years ago

Alutun commented 7 years ago

Hi guys, great lib to control spotify.

However i m running into an error when i try to get the state.

spotify.getState(function(err, state){});

here the full error :

TypeError: Cannot read property 'state' of undefined ....
at spotify-node-applescript/lib/spotify-node-applescript.js:98:20 at ChildProcess. (...node_modules/applescript/lib/applescript.js:54:7) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

even more weird seems that the Json object state is not empty because i can still print it. This happen even if my callback of the getState function is empty.

I have been looking in the code and also on the issue #28 but no luck for now.

OSX : 10.12 - node js V6.8.0 - npm 3.10.8

Hope you can help me =)

Alutun commented 7 years ago

One more hint, i just realised that if I restart my spotify i don't have the issue.