Closed yyz945947732 closed 1 year ago
Oh, Because my node version is lower than 18.0.0. So fetch
api is not support.
I just saw that lower versions of node cannot support this library.
Thanks for your reply.
From node 18 onwards the fetch api is available, but tagged as experimental: https://nodejs.org/en/blog/announcements/v18-release-announce or https://nodejs.org/dist/latest-v18.x/docs/api/globals.html#fetch
Once you upgraded your node to 18+ it should work out of the box.
I can't run this script in node environment. I think maybe you can add
node-fetch
package to the project and add polyfill like this:Then this package should be able to run directly in the node environment.