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

It throws error "fetch is not defined" #23

Closed
pekonchan opened this issue Jan 12, 2023 · 2 comments
Closed

It throws error "fetch is not defined" #23

pekonchan opened this issue Jan 12, 2023 · 2 comments

Comments

@pekonchan
Copy link

My demo is simple , just like this.

(async() => {
    const translate = require('google-translate-api-x');
    const res = await translate('Ik spreek Engels', {to: 'zh'});
    console.log(res.text);
})()

When run the code, it throws the error

image

@AidanWelch
Copy link
Owner

@pekonchan If you are using a node version before v17.5(I believe you are) you must use node-fetch as described in #20

@pekonchan
Copy link
Author

@pekonchan If you are using a node version before v17.5(I believe you are) you must use node-fetch as described in #20

oh, I got it . 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

2 participants