Closed johndoddsjr closed 2 years ago
Hello johndoddsjr,
Thanks for reporting this issue. I will look into it as soon as I can. It does appear from the docs that you can import the library asynchronously as you did; I'll update the tutorial after additionally confirming everything works well. Thank you for opening the issues you found! Your reports are greatly appreciated.
node-fetch has been updated. With the current configuration I get the following error: $ node oauth.js /node_modules/node-fetch/src/index.js:9 import http from 'node:http'; ^^^^
Source: https://www.npmjs.com/package/node-fetch#installation node-fetch from v3 is an ESM-only module - you are not able to import it with require(). If you cannot switch to ESM, please use v2 which remains compatible with CommonJS. Critical bug fixes will continue to be published for v2. npm install node-fetch@2
I also found that replacing line 7 const fetch = require('node-fetch'); // Import node-fetch with const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
also gets past the error and loads.