Search Terms
- ERR_UNKNOWN_FILE_EXTENSION
- Node.js 18.19.0
- Node.js 18.18.2
Expected Behavior
npx ts-node <script.ts> works on Node.js 18.19.0 just as it does with 18.18.2.
Actual Behavior
Since the upgrade to Node.js 18.19.0, the call fails with ERR_UNKNOWN_FILE_EXTENSION.
All other potentially related parameters remained unchanged (e.g. package-lock.json, ts-config.json, etc.).
We discovered this with GitHub workflow runs that run periodically (with schedule) at short intervals; only difference since things started failing is the Node.js version.
Steps to reproduce the problem
- set up Node.js 18.19.2
- set
"type": "module" in package.json
- set
"esm": true in tsconfig.json
- create
main.ts with something like: console.log('Hello world')
- run
npx ts-node main.ts
Minimal reproduction
see https://github.com/mlenkeit/ts-node-repro
there's also a GitHub workflow to run this repo against Node.js 18.19.0 and 18.18.2:
https://github.com/mlenkeit/ts-node-repro/actions/runs/7057725777
Specifications
- ts-node version: v10.9.1
- node version: v18.19.0
- TypeScript version: v5.2.2
- tsconfig.json, if you're using one:
{
"extends": "@tsconfig/node18/tsconfig.json",
"ts-node": {
"esm": true
},
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"moduleResolution": "Node",
"module": "ESNext",
"noImplicitAny": false,
"strictNullChecks": true,
"sourceMap": true,
"outDir": "./dist",
"resolveJsonModule": false,
"types": [
"node"
]
},
"exclude": ["node_modules"]
}
- package.json:
{
"name": "ts-node-repro",
"private": true,
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"dependencies": {
"@tsconfig/node18": "18.2.2",
"@types/node": "18.16.1",
"ts-node": "10.9.1",
"typescript": "5.2.2"
}
}
- Operating system and version: macOS Sonoma 14.1.1
Search Terms
Expected Behavior
npx ts-node <script.ts>works on Node.js18.19.0just as it does with18.18.2.Actual Behavior
Since the upgrade to Node.js
18.19.0, the call fails withERR_UNKNOWN_FILE_EXTENSION.All other potentially related parameters remained unchanged (e.g.
package-lock.json,ts-config.json, etc.).We discovered this with GitHub workflow runs that run periodically (with
schedule) at short intervals; only difference since things started failing is the Node.js version.Steps to reproduce the problem
"type": "module"inpackage.json"esm": trueintsconfig.jsonmain.tswith something like:console.log('Hello world')npx ts-node main.tsMinimal reproduction
see https://github.com/mlenkeit/ts-node-repro
there's also a GitHub workflow to run this repo against Node.js
18.19.0and18.18.2:https://github.com/mlenkeit/ts-node-repro/actions/runs/7057725777
Specifications