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: TwitchApi is not a constructor #40

Open
SteeledSlagle13 opened this issue Apr 7, 2022 · 1 comment
Open

TypeError: TwitchApi is not a constructor #40

SteeledSlagle13 opened this issue Apr 7, 2022 · 1 comment

Comments

@SteeledSlagle13
Copy link

running with a typescript application

"typescript": "^4.6.2"

import TwitchApi from 'node-twitch';
const twitch = new TwitchApi({
      client_id: environment.TWITCH_AUTH.client_id,
      client_secret: environment.TWITCH_AUTH.client_secret,
});
const user = await twitch.getUsers([name]);

I get this error when the method gets called

file:///F:/bot/src/commands/utility/twitch.command.ts:25
const twitch = new TwitchApi({
^
TypeError: TwitchApi is not a constructor

@adan-ea
Copy link

adan-ea commented May 4, 2022

Your import seems not correct, Have you tried to import it like that :

const TwitchApi = require('node-twitch').default;

I tried to reproduce it and the .default fixed it. Hope it helps.
I wish you an excellent day

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

2 participants