mods icon indicating copy to clipboard operation
mods copied to clipboard

node-fetch causing issues

Open WolfoTheWolf opened this issue 4 years ago • 1 comments

When you try to start your new bot project with mods, the "aaa_extensionHelper_EXT" trys to install the latest node-fetch, but it fails to install it.

image

npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT\aaa_extensionHelper_EXT\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT\aaa_extensionHelper_EXT\package.json'
npm WARN aaa_extensionHelper_EXT No description
npm WARN aaa_extensionHelper_EXT No repository field.
npm WARN aaa_extensionHelper_EXT No README data
npm WARN aaa_extensionHelper_EXT No license field.

+ [email protected]
added 4 packages from 5 contributors and audited 4 packages in 1.523s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

(aaa_extensionHelper_EXT Auto Module Installer) ~ Successfully Installed node-fetch. Note you may need to restart your bot.
(node:5764) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT\aaa_extensionHelper_EXT\node_modules\node-fetch\src\index.js
require() of ES modules is not supported.
require() of C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT\aaa_extensionHelper_EXT\node_modules\node-fetch\src\index.js from C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT.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.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT\aaa_extensionHelper_EXT\node_modules\node-fetch\package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.extensionHelper.requireModule (C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT.js:161:24)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.extensionHelper.autoUpdater (C:\Users\---\Desktop\New Bot Project\extensions\aaa_extensionHelper_EXT.js:167:27)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:5764) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5764) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Bot is ready!```

WolfoTheWolf avatar Sep 04 '21 21:09 WolfoTheWolf

Try changing the node-fetch manually in your package.json file. 2.6.5 should be fine.

almeidx avatar Oct 15 '21 17:10 almeidx