Luna-devv / dlist.js

The node.js v18 API wrapper for discordlist.gg

Home Page:https://github.com/Luna-devv/dlist.js#readme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with node.js

DanielGolan-mc opened this issue · comments

Error code:

{
  "error": {
    "message": "Must use import to load ES Module: /opt/node_modules/node-fetch/src/index.js\nrequire() of ES modules is not supported.\nrequire() of /opt/node_modules/node-fetch/src/index.js from /opt/node_modules/dlist.js/dist/client/RestManager.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.\nInstead rename index.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /opt/node_modules/node-fetch/package.json.\n",
    "stack": "Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /opt/node_modules/node-fetch/src/index.js\nrequire() of ES modules is not supported.\nrequire() of /opt/node_modules/node-fetch/src/index.js from /opt/node_modules/dlist.js/dist/client/RestManager.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.\nInstead rename index.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /opt/node_modules/node-fetch/package.json.\n\n    at new NodeError (internal/errors.js:322:7)"
  }
}
commented

I've fixed this issue in dlist.js@0.4.1!
Please note that you will have to use node-fetch@2 if you run bellow node.js v18

Tnx! Will use.

I've fixed this issue in dlist.js@0.4.1! Please note that you will have to use node-fetch@2 if you run bellow node.js v18

y'mean version 2?

commented

@DanielGolan-mc you will have to use node-fetch@2 (version 2) since all version above don’t support the way I have to import the module

@DanielGolan-mc you will have to use node-fetch@2 (version 2) since all version above don’t support the way I have to import the module

oh ok tnx