-
-
Notifications
You must be signed in to change notification settings - Fork 532
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 no matter what I do. #2033
Comments
hey @fmotion1 seems to be a known problem already, I have found the solution here on another thread #1997 (comment) and it worked for me. |
I managed to solve it:
This is what worked for me. I think the key was removing the module declaration from Here's my full {
"dependencies": {
"@iconify/json": "^2.2.85",
"@iconify/tools": "^3.0.2",
"@iconify/types": "^2.0.0",
"@iconify/utils": "^2.1.7",
"iconify": "^1.4.0",
"winston": "^3.9.0"
},
"scripts": {
"dev": "npx ts-node ./ExportSVGsFromJSON.ts"
},
"devDependencies": {
"@types/node": "^20.3.3",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
}
} And here's my full {
"compilerOptions": {
"target": "es6",
"skipLibCheck": true,
"lib": [
"ES6",
"dom"
],
"rootDir": ".",
"module": "commonjs",
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true,
"declaration": false,
"sourceMap": true,
"inlineSources": true,
"types": [
"node"
],
"stripInternal": true,
"incremental": true,
"skipDefaultLibCheck": true,
"inlineSourceMap": false,
"noEmit": false
},
"include": [
"./**/*"
],
"exclude": [
"node_modules"
],
"ts-node": {
"cwd": ".",
"projectSearchDir": ".",
"require": [],
"project": "./tsconfig.json"
}
} I try to avoid installing global packages for portability concerns. Really hope this manages to help some folks out there. Edit: tsx also works fine for me out of the box. |
@fmotion1 hmmm yeah, removing the |
I think is a bug. I also tried all the variants and
then it works as expected |
I experienced this just now and it was due to being on node20. Going back to node18 solved it for me. |
…1977) This pull request resolves #1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in #1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on #1937. That will not happen again.
No any solution yet??? |
This has worked for me on Node 20
|
…#1977) This pull request resolves #1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in #1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on #1937. That will not happen again.
…#1977) This pull request resolves #1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in #1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on #1937. That will not happen again.
…hadcn-ui#1977) This pull request resolves shadcn-ui#1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in shadcn-ui#1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on shadcn-ui#1937. That will not happen again.
…#1977) This pull request resolves #1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in #1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on #1937. That will not happen again.
…#1977) This pull request resolves #1926 and prevents issues like it from happening in the future ## Rationale for this PR This PR changes the TypeScript execution package for use in scripts like `build:registry` from `ts-node` to `tsx`. This is because `ts-node` has many difficult quirks to work through (and is slow). In addition, it also has a difficult to understand error for newcomers that *is* reproducible. ### The ts-node error As shown in #1926, using `ts-node` (specifically in `build:registry`) results in this error: `Unknown file extension ".ts" for /ui/apps/www/scripts/build-registry.ts`. There are many issues in the `ts-node` repository documenting this problem: * TypeStrong/ts-node/issues/1062 * TypeStrong/ts-node/issues/2033 * TypeStrong/ts-node/issues/1997 Switching the typescript-in-node system to `tsx`, which uses esbuild under the hood, resolves this error. This PR shouldn't affect tests, representation, etc. and is merely a change of build tools. There is no urgent need to merge this. I accidentally deleted the head repository on #1937. That will not happen again.
Search Terms
ERR_UNKNOWN_FILE_EXTENSION
Unknown file extension ".ts"
I've tried re-installing ts-node over and over again, both globally and in scope of my project. No matter what I do, I hit the
ERR_UNKNOWN_FILE_EXTENSION
wall.I've read through the documentation here about the error, and none of the suggestions have fixed my problem.
I've tried:
ts-node-esm ExportSVGsFromJSON.ts
ts-node --esm ExportSVGsFromJSON.ts
I am on
v10.9.1
of TS-Node.I have not moved my project to ESM and have no config other than
tsconfig.json
.Essentially, none of the suggestions have helped.
The kicker is that I actually had this working fine a few hours ago, but now its failing after a fresh reinstall.
Expected Behavior
ts-node .\ExportSVGsFromJSON.ts
executes my TypeScript file.Actual Behavior
ts-node .\ExportSVGsFromJSON.ts
throws aERR_UNKNOWN_FILE_EXTENSION
error. The complete error is here:Steps to reproduce the problem
npm install @iconify/tools --save
npm install @iconify/utils --save
npm i @iconify/types
npm install typescript --save-dev
npm install -D ts-node
(or Globally, the result is the same)Run
ts-node .\ExportSVGsFromJSON.ts
Minimal reproduction
Install Iconify utils and tools, typescript, and ts-node. Try to run a TS script with ts-node.
Specifications
I could really use some help here. I had this working nearly 2-3 hours ago and I must have messed something up. I also noticed that
@iconify/json
was updated in the last 6 hours. Maybe that has something to do with it.If someone can point me in the right direction that would be a lifesaver.
Thank you.
The text was updated successfully, but these errors were encountered: