ERR_UNKNOWN_FILE_EXTENSION running a basic ts file?
See original GitHub issueNot sure what I’m doing wrong but…
node -r esbuild-runner/register helloworld.ts
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/cjr/dev/packages/api/helloworld.ts
at new NodeError (node:internal/errors:363:5)
at Loader.defaultGetFormat [as _getFormat] (node:internal/modules/esm/get_format:71:15)
at Loader.getFormat (node:internal/modules/esm/loader:105:42)
at Loader.getModuleJob (node:internal/modules/esm/loader:243:31)
at Loader.import (node:internal/modules/esm/loader:177:17)
at Object.loadESM (node:internal/process/esm_loader:68:5)
helloworld.ts:
console.log("HELLO WORLD LITERALLY!");
export default {}
node -v
> v16.3.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:21
- Comments:8
Top Results From Across the Web
Can't run my Node.js Typescript project TypeError ...
I just resorted to using tsc --outDir out file.ts and then running ... Then Just Run the main script with this node --loader...
Read more >Error: unknown file extension .ts · Issue #1062 - GitHub
When I try to execute a typescript file I get the following error message: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ...
Read more >ts-node - npm
ERR_UNKNOWN_FILE_EXTENSION. This error is thrown by node when a module has an unrecognized file extension, or no extension at all, and is being ......
Read more >How To Run TypeScript Scripts with ts-node - DigitalOcean
In this article you will learn how to run TypeScript scripts without the hassle of manually transpiling.
Read more >How to Setup a TypeScript project using Rollup.js
Source Code Files. Let's create a library to perform basic Math operations and perform strings processing. The project will contain the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m getting
ERR_UNKNOWN_FILE_EXTENSION
as well using esr in my ESM project, using NPM.https://github.com/antfu/esno seems to work with ES modules.