-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
I tried to run the example for generating and Authorization URL, but Node JS failed with this error.
import generator, { OAuth } from 'megalodon'
^^^^^
SyntaxError: Named export 'OAuth' not found. The requested module 'megalodon' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'megalodon';
const { OAuth } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:177:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:260:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
Node.js v22.11.0
What I did:
- I installed the latest version of Node JS in Windows 10, using its MSI installer.
- In a folder on my hard drive, I opened a command prompt and typed:
npm install megalodon - I logged into a mastodon instance and used Firefox's dev tools to find the clientid and the clientsecret from the "Storage" tab and "Indexed DB" section.
- I created a file called "register_application.js" and pasted the 1st example code under the "Authorization" section of your readme.
- I modified the BASE_URL, clientId, and clientSecret with the values from the web dev tools. (actual values redacted for privacy)
const BASE_URL = 'https://mymastodon.website'
let clientId = "xxxxxxxxxx"
let clientSecret = "yyyyyyyyy" - I created a CMD file containing:
node register_application.js
pause
- When I ran this CMD file, the error occurred.
Which part did I do wrong?
Metadata
Metadata
Assignees
Labels
No labels