You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
./node_modules/.bin/nyc --reporter=lcov --reporter=text ./node_modules/.bin/mocha tests --timeout 10000 --recursive --check-leaks --exit --reporter mocha-junit-reporter --reporter-options mochaFile=test_reports/mocha/test-results.xml
node:internal/modules/cjs/loader:1109
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /root/workspace/node_modules/read-pkg-up/index.js
require() of ES modules is not supported.
require() of /root/workspace/node_modules/read-pkg-up/index.js from /root/workspace/node_modules/test-exclude/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 /root/workspace/node_modules/read-pkg-up/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /root/workspace/node_modules/read-pkg-up/package.json.
at new NodeError (node:internal/errors:329:5)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1109:13)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/root/workspace/node_modules/test-exclude/index.js:4:19)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32) {
code: 'ERR_REQUIRE_ESM'
}
Exited with code exit status 1
@sindresorhus Would you consider releasing a hybrid version (ESM + common js)?
I use typescript but I have to release my project in hybrid mode for compatibility.
But v8 breaks the possibility because the code can't call read-pkg-up in the commonjs way anymore.
Using
node:latest
bumps into this error:https://stackoverflow.com/questions/66938218/node-js-read-pkg-up-bumps-into-error-err-require-esm-must-use-import-to-load
The text was updated successfully, but these errors were encountered: