1

I've installed the got NPM module into my project but now it's causing problems.

It's saying to remove type:module but I can't do that since it's an NPM module and not mine.

How do I get around this?

It's a fresh project that's been generated with NestJS, nothing else in it that could cause problems.

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\src\faastracker-api\node_modules\got\dist\source\index.js
require() of ES modules is not supported.
require() of C:\src\faastracker-api\node_modules\got\dist\source\index.js from C:\src\faastracker-api\dist\scraping-bee\scraping-bee.service.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:\src\faastracker-api\node_modules\got\package.json.
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
user9754798
  • 363
  • 3
  • 15

0 Answers0