abhishekjnvk / telegram-channel-downloader

Open Source Node.js script that simplifies scraping media files and messages from Telegram channels, groups, or users, facilitating offline access and storage of images, videos, and documents
106 stars 22 forks source link

ERR_REQUIRE_ESM #9

Closed lemonkeystudios closed 6 months ago

lemonkeystudios commented 6 months ago

Getting this error when attempting to run "npm start"

const inquirer = require("inquirer");
                 ^
Error [ERR_REQUIRE_ESM]: require() of ES Module <my folder>\telegram-channel-downloader-main\node_modules\inquirer\lib\inquirer.js from <my folder>\telegram-channel-downloader-main\modules\auth.js not supported.

Instead change the require of inquirer.js in <my folder>\telegram-channel-downloader-main\modules\auth.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (<my folder>\telegram-channel-downloader-main\modules\auth.js:1:18) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.13.1

I've replaced my actual path with 'my folder' in this description. Not sure if this is because I'm using the wrong version of a dependency? I'm made sure the following are installed via npm - ejs, enquirer, inquirer, mime-db, node-fetch and telegram

cory-brown commented 6 months ago

Add:

"inquirer": "^8.2.6"

to "dependencies" in the package.json file

abhishekjnvk commented 6 months ago

@lemonkeystudios The issue has been fixed with the latest commit. Please pull the latest changes. Thank you.