M S*_*M S 1 javascript webstorm typescript solidity
`"C:\\Program Files\\nodejs\\node.exe" C:\\Users\\Keith\\WebstormProjects\\flashbot\\src\\index.ts\ninternal/process/esm_loader.js:74\n internalBinding(\'errors\').triggerUncaughtException(\n ^\nTypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\\Users\\Keith\\WebstormProjects\\flashbot\\src\\in\ndex.ts\n\xe2\x86\x90[90m at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15)\xe2\x86\x90[39m\n\xe2\x86\x90[90m at Loader.getFormat (internal/modules/esm/loader.js:105:42)\xe2\x86\x90[39m\n\xe2\x86\x90[90m at Loader.getModuleJob (internal/modules/esm/loader.js:243:31)\xe2\x86\x90[39m\n\xe2\x86\x90[90m at async Loader.import (internal/modules/esm/loader.js:177:17)\xe2\x86\x90[39m\n\xe2\x86\x90[90m at async Object.loadESM (internal/process/esm_loader.js:68:5)\xe2\x86\x90[39m {\n code: \xe2\x86\x90[32m\'ERR_UNKNOWN_FILE_EXTENSION\'\xe2\x86\x90[39m\n}\nProcess finished with exit code 1`\nRun Code Online (Sandbox Code Playgroud)\n这个项目有很多代码和文件,所以我不知道要调整什么。然而,如果您认为您知道解决方案,它确实存在于 github 上 - https://github.com/flashbots/searcher-minter 。
\n您无法通过直接将 Typescript 代码传递给 Node.js 来运行它,Node.js 不提供对执行 Typescript 的本机支持。代码必须即时编译或预编译。这里有一些食谱:
使用以下命令运行选定的 TypeScript 文件ts-node:
npm i ts-node。--require ts-node/register到节点参数字段。$FilePathRelativeToProjectRoot$.如果您需要将任何其他参数传递给ts-node(例如--project tsconfig.json),您可以将它们添加到运行/调试配置中的应用程序参数字段。
使用 TypeScript 编译应用程序并运行选定的 TypeScript 文件
tsconfig.json。.js。$FileRelativeDir$/$FileNameWithoutExtension$.jsbuild/$FileRelativeDir$/$FileNameWithoutExtension$.js