Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

465
Visualizações
Having error, keeps saying Unknown File Extension
`"C:\Program Files\nodejs\node.exe" C:\Users\Keith\WebstormProjects\flashbot\src\index.ts
internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\Users\Keith\WebstormProjects\flashbot\src\in
dex.ts
←[90m    at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15)←[39m
←[90m    at Loader.getFormat (internal/modules/esm/loader.js:105:42)←[39m
←[90m    at Loader.getModuleJob (internal/modules/esm/loader.js:243:31)←[39m
←[90m    at async Loader.import (internal/modules/esm/loader.js:177:17)←[39m
←[90m    at async Object.loadESM (internal/process/esm_loader.js:68:5)←[39m {
  code: ←[32m'ERR_UNKNOWN_FILE_EXTENSION'←[39m
}
Process finished with exit code 1`

There is a lot of code and files for this project so I'm not sure what to tweak. It does, however, exist on github - https://github.com/flashbots/searcher-minter if you think you know the solution.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You can't run the Typescript code by passing it to Node.js directly, Node.js doesn't provide native support for executing Typescript. The code has to be either compiled on-the-fly or precompiled. here are some recipes:

  • To run a selected TypeScript file using ts-node:

    • Install ts-node using npm i ts-node.
    • Create a new Node.js run/debug configuration.
    • Add --require ts-node/register to the Node parameters field.
    • In the JavaScript file field add $FilePathRelativeToProjectRoot$.
    • Save configuration.
    • Use it to run (or debug) a file that is currently opened in the editor or selected in the Project view. You can do that using the icons on the navigation bar or Run... action.

If you need to pass any additional parameters to ts-node (e.g. --project tsconfig.json), you can add them to the Application parameters field in the run/debug configuration.

  • To compile app with TypeScript and run a selected TypeScript file

    • Create a Node.js run/debug configuration.
    • In the Before Launch section, click Add and select Compile TypeScript.
      • Select tsconfig.json.
      • In the JavaScript file field you need to select the path to the compiled .js file.
      • If a compiled JavaScript lives next to its source, add $FileRelativeDir$/$FileNameWithoutExtension$.js
      • If files are saved in an output folder (preserving the folder structure), add the folder name before the pattern, e.g. build/$FileRelativeDir$/$FileNameWithoutExtension$.js
      • Save configuration.
      • Use it to run (or debug) a file that is currently opened in the editor or selected in the Project view.
about 4 years ago · Juan Pablo Isaza Relatório

0

I think you should adjust your tsconfig.json file and add a new start script, I think maybe the global script you trying to run can't find the ts-node module

{
  "compilerOptions": {
    "target": "ES2018",
    "module": "commonjs",
    "lib": [
      "es2018"
    ],
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "typeRoots": [
      "./node_modules/@types"
    ]
  },
  "exclude": [
    "node_modules",
  ]
}

###Add new start in your package.json

  "scripts": {
    "start": "npx ts-node src/index.ts"
  },
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda