Skip to content

Cant run my typescript file #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Phyroks opened this issue Jul 6, 2022 · 5 comments
Open

Cant run my typescript file #1

Phyroks opened this issue Jul 6, 2022 · 5 comments

Comments

@Phyroks
Copy link

Phyroks commented Jul 6, 2022

internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/container/index.ts
at new NodeError (internal/errors.js:322:7)
at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15)
at Loader.getFormat (internal/modules/esm/loader.js:105:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:243:31)
at async Loader.import (internal/modules/esm/loader.js:177:17)
at async Object.loadESM (internal/process/esm_loader.js:68:5) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

@Tolfx
Copy link
Member

Tolfx commented Jul 6, 2022

Hi!
Are you using the correct image? Also node can't directly run .ts you need to compile them.

@Phyroks
Copy link
Author

Phyroks commented Jul 6, 2022

How do I compile it ?

@Tolfx
Copy link
Member

Tolfx commented Jul 6, 2022

How do I compile it ?

Well it does compile with tsc, but in your tsconfig.json you need to specific where the outDir will be. Then run your index where it got compiled.

@Phyroks
Copy link
Author

Phyroks commented Jul 6, 2022

I don't have a ts-config

@Tolfx
Copy link
Member

Tolfx commented Jul 7, 2022

How did you run it before? With ts-node?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants