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

Error: DefaultTransporter is not a constructor #816

Closed
raapperez opened this issue Sep 22, 2017 · 3 comments · Fixed by #829
Closed

Error: DefaultTransporter is not a constructor #816

raapperez opened this issue Sep 22, 2017 · 3 comments · Fixed by #829
Assignees

Comments

@raapperez
Copy link

I'm using node version 8.5.0 on windows and I'm getting the following error on this line:

var google = require('googleapis');

const transporter = new DefaultTransporter();
                    ^

TypeError: DefaultTransporter is not a constructor
    at Object.<anonymous> (***\node_modules\googleapis\lib\discovery.js:23:21)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (***\node_modules\googleapis\lib\googleapis.js:17:21)
    at Module._compile (module.js:624:30)

I'm using:

"google-auth-library": "^0.11.0",
"googleapis": "^22.1.0",

How can I solve this?

Thanks!

@bantini
Copy link
Contributor

bantini commented Sep 29, 2017

@raapperez I am trying to replicate your error. Which version of Windows are you using?

@raapperez
Copy link
Author

I was using windows 10.

This exception also throws in mac...

I made an workaround changing the file node_modules/googleapis/lib/discovery.js in line 21:
From

const DefaultTransporter = require("google-auth-library/lib/transporters");

to

const DefaultTransporter = require("google-auth-library/lib/transporters").DefaultTransporter;

@isonet
Copy link
Contributor

isonet commented Oct 21, 2017

I encountered the same issue.

It should work if you use v0.10.0 of the google-auth-library instead of v0.11.0. It seems that this library is not yet compatible with v0.11.0, I submitted a PR to fix this.

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

Successfully merging a pull request may close this issue.

3 participants