NodeError: Must use import to load ES Module


I’m trying to use “got” (also tried node-fetch):
var got = require("got");

I get this error:

NodeError: Must use import to load ES Module: /app/available_modules/1640943230000/got/dist/source/index.js
require() of ES modules is not supported.
require() of /app/available_modules/1640943230000/got/dist/source/index.js from /app/index.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 /app/available_modules/1640943230000/got/dist/source/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /app/available_modules/1640943230000/got/package.json.


RunKit states that import does not work, so how can I get around this?

edit. Switched to node v17.1.0:

Error: require() of ES Module /app/available_modules/1640943512000/got/dist/source/index.js from /app/index.js not supported.
Instead change the require of /app/available_modules/1640943512000/got/dist/source/index.js in /app/index.js to a dynamic import() which is available in all CommonJS modules.

Tried import { got } from 'got'; but the result is import is not yet supported in RunKit..

Okay, finally found how to specify dependency version. This works:
var got = require("got@11.8.2");