Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: OneSignalClient is not a constructor #7

Open
HostOnNet opened this issue Jul 1, 2017 · 4 comments
Open

TypeError: OneSignalClient is not a constructor #7

HostOnNet opened this issue Jul 1, 2017 · 4 comments

Comments

@HostOnNet
Copy link

HostOnNet commented Jul 1, 2017

> root@ip-172-31-41-200:/usr/share/nginx/html/webapps/node_modules/node-onesignal/dist# node
> var OneSignalClient = require('node-onesignal');
undefined
> var client = new OneSignalClient('1', '2');
TypeError: OneSignalClient is not a constructor
    at repl:1:14
    at ContextifyScript.Script.runInThisContext (vm.js:23:33)
    at REPLServer.defaultEval (repl.js:339:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.onLine (repl.js:536:10)
    at emitOne (events.js:101:20)
    at REPLServer.emit (events.js:191:7)
    at REPLServer.Interface._onLine (readline.js:241:10)
    at REPLServer.Interface._line (readline.js:590:8)
> 

Node version is

# node --version
v7.10.0
#

Any idea how to fix this error ?

EDIT: i tried on v8.0.0, got same error

@spacegraym3
Copy link

Same issue here

@HostOnNet
Copy link
Author

I got it fixed by using

const OneSignalClient = require('node-onesignal').default;

@jamesdixon
Copy link
Contributor

I believe this has something to do with the Babel transpilation and Node 7/8. I'll try to look at this sometime soon and resolve it.

Thanks for reporting!

@spacegraym3
Copy link

Thanks @HostOnNet and @jamesdixon. @HostOnNet, your workaround worked beautifully. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants