The error occurs when the type property is set to module in package.json. You can solve it by using the ts-node command with the –esm flag. Or remove the “type”: “module” property from package.json. An example shows the error happening when type is set to module. A solution is to upgrade to ts-node version 10.6.0 or higher. This implements a workaround. Another solution is to use ts-node-esm or add “ts-node”: {“esm”: true} to tsconfig.json. The error means node cannot execute the file extension. Native ESM does not support extensionless files like CommonJS does. When running a script with ts-node, this error appears: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension “.ts”. Installing Typescript and @types/node fixes it. The steps are: Install Typescript and run the command in terminal. Then install @types/node. This transpiles TypeScript to JavaScript so node can run it without errors. The error is thrown when a module has an unrecognized extension or none. Mocha is an example. Its binary is extensionless but native ESM requires extensions.