Open luyifo opened 1 month ago
I had the same issue, downgrade Node to 18.18 help. My engines:
"engines": {
"node": ">=18.18.0 <18.19.0"
},
Have you solved this problem?I switched the versions of 22,18 and 16 with different problems, and the configuration file has been modified, but it still doesn't work
"module": "CommonJS", "esModuleInterop": true,
My code compilation is no problem, I specially configured a file for "ts-node", code compilation is another file, anyway just to see the state of writing code, so I specially configured a file for "ts-node", compilation is another file;"tsconfig.dev.json"and"tsconfig.json"
"dev": "cross-env TS_NODE_PROJECT=tsconfig.dev.json nodemon --exec ts-node src/main.ts",
"dev": "cross-env TS_NODE_PROJECT=tsconfig.dev.json nodemon --exec ts-node src/main.ts",
seems to work for me with node and --loader
flag
{
"scripts": {
- "not-work": "ts-node-esm src/main.ts",
+ "dev": "node --loader ts-node/esm --no-warnings=ExperimentalWarning src/main.ts"
}
}
node: v20.5.0 ts-node: v10.9.2
seems to work for me with node and
--loader
flag{ "scripts": { - "not-work": "ts-node-esm src/main.ts", + "dev": "node --loader ts-node/esm --no-warnings=ExperimentalWarning src/main.ts" } }
node: v20.5.0 ts-node: v10.9.2
This worked for me. Thanks @lhapaipai
Search Terms
When the node version is 18.20.0, running TS-node --esm **.ts displays TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts". Runs successfully after the Node version is reduced to 16.20.2.
Expected Behavior
Actual Behavior
Steps to reproduce the problem
Minimal reproduction
Specifications