i got this error when i deploy my mern app with typescript
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension “.ts” for /opt/render/project/src/backend/index.ts
repo → GitHub - capo33/cooking-blog
thanks
i got this error when i deploy my mern app with typescript
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension “.ts” for /opt/render/project/src/backend/index.ts
repo → GitHub - capo33/cooking-blog
thanks
Hi there,
Unless something has changed recently, don’t you need to use ts-node
when running Typescript or transpile it to Javascript with tsc
first and then run the Javascript? It may depend on how you are running this on Render as this is clear from the limited information you have given. You have the following scripts defined:
"start": "TG_ALLOW_MIXED=ALLOW node backend/index","server": "nodemon backend/index",
Node itself won’t work and the start script is probably causing this, you probably should have ts-node
. Nodemon is actually aware you are running Typescript and will use ts-node
instead of node
to run your code.
Regards,
Keith
Render Support, UTC+10
Thanks for your replay.
i got the message Build successful but then it fail because of this line (node:50) Warning: To load an ES module, set “type”: “module” in the package.json or use the .mjs extension.
so i tried many ways to avoid that but did not work
any other solution
Thanks in advance
Hi there,
I think you need to add something like tsc -p backend/tsconfig.json
and then run your app with node backend/build/index.js
Regards,
Keith
Render Support, UTC+10
Hello Keith!
Thank you so much that’s really work, you have save many days of debugging , now i am able to deploy all typescript apps
Thanks
Regards,
Mohamed
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.