-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" #120
Comments
Hey mate, have you tried using node 18? The entire repo js built with node 18 and I've not had any issues or reports until now, I haven't tested it with node 20 but might have a play soon to see what we can do, this bloody error is extremely frustrating it is a wildly over reported error 😅 |
I'm new to node apps, so I just have the latest node installed. |
Well, I didn't know node 21 had problems haha, otherwise it would have been in the docs 😁 |
all good man, It's a nice repo, I've build a media browser to use with a touchscreen for my kids to select a show or movie to play on the tv via jellyfin(for now) |
That's wicked, screenshots? |
Nice one mate! Looks great! |
I happened to run into this too and wasn't too successful downgrading node, but I was able to fix this by using In
|
Which version of node are you using @kneath ? |
I'm running |
The tsx worked for me too Kyle,
From what I understand tsx doesn't report any errors so I opted for the
tsimp method.
…On Fri, Feb 23, 2024, 9:51 p.m. Kyle Aster ***@***.***> wrote:
I'm running v21.6.2 right now — I attempted to use 18.19.1 but still ran
into the same issues listed at the top (likely I didn't have my nvm setup
correctly or something like that).
—
Reply to this email directly, view it on GitHub
<#120 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEDBENTX3DME6HBOFC7AIH3YVFITRAVCNFSM6AAAAABDLJ4S26VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSGIZDMNRYGM>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
I will re-open this and publish with a few more changes, as when i first built this --esm was the only way I could get the scripts to execute but it seems that's changed now.
|
I haven't forgotten about this - been very busy with personal life and will get to this soon! |
Can you update please 😅 |
I will @novisys paitence my friend :D This isn't a blocking issue, simply swap to node 18 for now :) |
Have just done a bit of testing:
Will attempt to release this next week |
Should be resolved with the latest release of create-hakit - run |
Describe the bug
Running the "npm run build && npm run deploy" get to run "npx ts-node --esm ./sync-types.ts" and errors:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/dylanmcleod/Library/CloudStorage/Dropbox/Jellyfin/Custom Dashboards/test-build/sync-types.ts
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9)
at defaultGetFormat (node:internal/modules/esm/get_format:203:36)
at defaultLoad (node:internal/modules/esm/load:143:22)
at async nextLoad (node:internal/modules/esm/hooks:750:22)
at async nextLoad (node:internal/modules/esm/hooks:750:22)
at async Hooks.load (node:internal/modules/esm/hooks:383:20)
at async handleMessage (node:internal/modules/esm/worker:199:18) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
To Reproduce
Steps to reproduce the behavior:
Screenshots / code examples
System Info (please complete the following information):
Additional context
After researching(Googling) and trying so many different things, I finally found this github issue(jumping to resolution): TypeStrong/ts-node#1997 (comment)
It indicated on node 20 and ESM ts-node-esm doesn't work, there were a few alts but i went with installing tsim and changing the sync in the package.json from default: "sync": "npx ts-node --esm ./sync-types.ts", to this: "sync": "TSIMP_DIAG=error node --import=tsimp/import ./sync-types.ts",
it builds but still fails (TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" ... scripts/deploy.ts ) on running the deploy command "npx ts-node --esm scripts/deploy.ts"
if I update deploy in package.json to: "deploy": "TSIMP_DIAG=error node --import=tsimp/import scripts/deploy.ts"
it just errors with "Error:" this wasn't a big issue as i just manually added the dist folder files to Home Assistant.
Hope all this helps
The text was updated successfully, but these errors were encountered: