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
{{ message }}
Repository navigation
Add common ESM errors to Troubleshooting page #1607
There are a few errors thrown by node -- and by our copy-pasted node code -- that confuse users. Add these to the troubleshooting page.
For example, when you try to require() a TS file and it's supposed to be executed as native ESM, the user gets a cryptic ERR_REQUIRE_ESM. When they try to do the same via import() instead of require() -- or node ./index.ts inside a type: module directory -- they get ERR_UNKNOWN_FILE_EXTENSION
Note the ERR_UNKNOWN_FILE_EXTENSION also happens with extensionless files, like require.resolve("mocha/bin/mocha") (which breaks ts-mocha at the moment).
Regarding ERR_UNKNOWN_FILE_EXTENSION and mocha's extensionless entrypoint:
Linking to https://github.com/nodejs/node/discussions/41711 where the solution is being discussed. Once a solution is settled upon, ts-node can implement a workaround to mimic the fixed behavior on old node versions.
Activity
simonbuchan commentedon Feb 3, 2022
Note the
ERR_UNKNOWN_FILE_EXTENSIONalso happens with extensionless files, likerequire.resolve("mocha/bin/mocha")(which breaksts-mochaat the moment).cspotcode commentedon Feb 3, 2022
Regarding
ERR_UNKNOWN_FILE_EXTENSIONand mocha's extensionless entrypoint:Linking to https://github.com/nodejs/node/discussions/41711 where the solution is being discussed. Once a solution is settled upon, ts-node can implement a workaround to mimic the fixed behavior on old node versions.
Resolve #1607: explain common ESM errors in troubleshooting page
Docs overhaul (#1682)
Update dependency ts-node to v10.8.0 (#1367)