-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
ERR_UNKNOWN_FILE_EXTENSION since Node.js 18.19.0 (works fine with 18.18.2) #2094
Comments
Workaround: You can use |
@michael42 thanks for the suggestion. This indeed works with both Node.js I will, however, hold back with applying that change for now, as this would require changes across a dozen or so repos. We've simply pinned Node.js to I still consider this to be a bug in |
Node v18.19.0 breaks `ts-node-esm`, so `pnpm install` won't work. See: TypeStrong/ts-node#2094
Same issue in node |
This does not seem to work for me:
|
We were using a floating version of node in our base images, which means we didn't control when we updated the node version. Also, we were using an outdated version for local development, which didn't match the one used for the base images. This changeset bumps nvmrc to latest node (18.19.0) and pins down the version of all node base images across dockerfiles in the project. This PR was triggered by suddenly hitting [this error](TypeStrong/ts-node#2094) in CI.
Make sure you have |
We were using a floating version of node in our base images, which means we didn't control when we updated the node version. Also, we were using an outdated version for local development, which didn't match the one used for the base images. This changeset bumps nvmrc to latest node (18.19.0) and pins down the version of all node base images across dockerfiles in the project. This PR was triggered by suddenly hitting [this error](TypeStrong/ts-node#2094) in CI.
@jetwiwo right, thanks for mentioning that. FWIW, it looks like it doesn't work with Node.js 20 at all. I've added Node.js 20 versions to the repo for reproducing the problem. https://github.com/mlenkeit/ts-node-repro/actions/runs/7125070507 |
There is issue with node 18.19 and also newer version breaking ts-node: TypeStrong/ts-node#2094. This is a quick fix until finding a more proper solution.
There is issue with node 18.19 and also newer version breaking ts-node: TypeStrong/ts-node#2094. This is a quick fix until finding a more proper solution.
This fix triggers some warnings about experimental features, and it's meant to be temporary until ts-node shares a long-term solutio . See TypeStrong/ts-node#2094.
This fix triggers some warnings about experimental features, and it's meant to be temporary until ts-node shares a long-term solutio . See TypeStrong/ts-node#2094.
See #1997 - this sounds like a duplicate of that one. |
Update the ng-dev configuration to be compatible with Node.js 18.16. This adjustment eliminates the necessity for ts-node, which is crucial due to compatibility issues between the current tsnode esm version and the latest ESM loaders. For more details, refer to: TypeStrong/ts-node#2094
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Update ng-dev setup to work with 18.19 For more details, refer to: TypeStrong/ts-node#2094 (cherry picked from commit a6129a6)
Any update on this? This has rendered ts-node completely unusable and not fit for purpose. The |
The other workaround is to use tsx instead. tsx also comes with watch mode, which is a bonus. |
Nodejs v18.19.0 breaks ts-node. See: https://nodejs.org/en/blog/release/v18.19.0 TypeStrong/ts-node#2094
For anyone looking for a one-liner workaround in the future, you can implement @qiulang's suggestion by making the following change in your - "app": "npx ts-node --prefer-ts-exts bin/project-cdk.ts",
+ "app": "npx tsx bin/project-cdk.ts", Since both tsx is called via npx, you technically don't need to add it as a dependency... But it's probably a good idea to run an |
@andrewodri 's answer works for me! Just to make it super clear, you're not running More of a note to my future self for future projects because I'm bound to forget. |
Search Terms
Expected Behavior
npx ts-node <script.ts>
works on Node.js18.19.0
just as it does with18.18.2
.Actual Behavior
Since the upgrade to Node.js
18.19.0
, the call fails withERR_UNKNOWN_FILE_EXTENSION
.All other potentially related parameters remained unchanged (e.g.
package-lock.json
,ts-config.json
, etc.).We discovered this with GitHub workflow runs that run periodically (with
schedule
) at short intervals; only difference since things started failing is the Node.js version.Steps to reproduce the problem
"type": "module"
inpackage.json
"esm": true
intsconfig.json
main.ts
with something like:console.log('Hello world')
npx ts-node main.ts
Minimal reproduction
see https://github.com/mlenkeit/ts-node-repro
there's also a GitHub workflow to run this repo against Node.js
18.19.0
and18.18.2
:https://github.com/mlenkeit/ts-node-repro/actions/runs/7057725777
Specifications
The text was updated successfully, but these errors were encountered: