PS
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /app/src/index.ts
Hello everyone! I urgently need your help, cause my service is down for almost a day.
I have a telegram bot running on railway and everything was fine since April. Yet today after DB migration the service was restarted and I got the error
ERR_UNKNOWN_FILE_EXTENSION
(see title).
I'm using ts-node
as a runtime, e.g I have "start": "ts-node --esm src/index.ts"
in scripts,
esm is on in tsconfig
though in package.json I never used "type": "module"
.
I can run the script locally without any problem, but it constantly fails on deployment:
[email protected] start ts-node --esm src/index.ts TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /app/src/index.ts at new NodeError (node:internal/errors:405:5) at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:136:11) at defaultGetFormat (node:internal/modules/esm/get_format:182:36) at defaultLoad (node:internal/modules/esm/load:101:20) at nextLoad (node:internal/modules/esm/hooks:864:28) at load (/app/node_modules/ts-node/dist/child/child-loader.js:19:122) at nextLoad (node:internal/modules/esm/hooks:864:28) at Hooks.load (node:internal/modules/esm/hooks:447:26) at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24) at [nodejs.internal.kHybridDispatch] (node:internal/event_target:786:20) { code: 'ERR_UNKNOWN_FILE_EXTENSION' }I used it thins way from the very beginning — all was good. It started to fail only today. Do you have any idea what is wrong?
12 replies