ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 206 forks source link

node-gcm : TypeError: gcm.Message is not a function #249

Closed 0xparashar closed 8 years ago

0xparashar commented 8 years ago

I am getting this error when i try to use node-gcm in my code. I have included it as per standard methods require('node-gcm')

var message = new gcm.Message(); ^ TypeError: gcm.Message is not a function at Object. (/home/parashar/Downloads/opentsdb.js:13:15) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.Module.runMain (module.js:441:10) at startup (node.js:139:18) at node.js:968:3

Is it because of some compatibility issue, but I even tried changing the node version

eladnava commented 8 years ago

@hypesystem did you publish v1.0.0 alpha as the stable package version on npm by accident without tagging?

robertklep commented 8 years ago

I think so:

$ npm info node-gcm | grep version:
  version: '1.0.0-alpha.1'
hypesystem commented 8 years ago

@robertklep and @ankitiitb1069 do an npm install node-gcm@0.14.2 to get the right version.

I am not at a computer right now. One solution would be @eladnava publishing a version 0.14.3 from master over it to correct this.

The release is tagged as pre-release but still downloaded with normal install. Maybe we should update the installation instructions?

I don't quite understand why a release tagget as pre-release is the default install.

eladnava commented 8 years ago

Published 0.14.3 (which is identical to 0.14.2).

You can now install node-gcm as expected:

npm install node-gcm

The pre-release tag indeed inhibits some pretty weird behavior. We'll definitely check this out and prevent this from happening again.

Thanks for your report @ankitiitb1069! 😄