This means we are installing the latest version of got. Since v12.0.0 the package is pure ESM, so we must use import to load it or we'll get the following error
~/index.js:3
const got = require('got');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module ~/node_modules/got/dist/source/index.js from ~/index.js not supported.
Instead change the require of ~/node_modules/got/dist/source/index.js in ~/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (~/index.js:3:13) {
code: 'ERR_REQUIRE_ESM'
}
To reproduce the error, you need to install the dependencies the way the README.md says and try to run any example that requires got package.
There are two solutions as I see, we could rewrite all the scripts that fail or we could install a previous version to v12.0.0. So in order to run the examples as they are without any script change, I suggest adding a version range with a "less than" symbol.
If we just copy the dependencies installation code from JavaScript (Node.js) environment set up, we'll get the following
This means we are installing the latest version of
got
. Since v12.0.0 the package is pure ESM, so we must useimport
to load it or we'll get the following errorTo reproduce the error, you need to install the dependencies the way the README.md says and try to run any example that requires
got
package.There are two solutions as I see, we could rewrite all the scripts that fail or we could install a previous version to v12.0.0. So in order to run the examples as they are without any script change, I suggest adding a version range with a "less than" symbol.