google-gemini/gemini-cli

Fix TypeScript execution in “CLI: Run Current File” debug configuration

已关闭

#22,844 创建于 2026年3月17日

 (12 条评论) (0 个反应) (1 位负责人)TypeScript (13,657 个派生)batch import
area/extensionseffort/smallhelp wantedkind/bugpriority/p2status/bot-triagedstatus/need-informationstatus/possible-duplicate

仓库指标

星标
 (103,992 个星标)
PR 合并指标
 (平均合并 4天 2小时) (30 天内合并 55 个 PR)

描述

URL of the page with the issue

cant find at the moment

What is the problem?

The current “CLI: Run Current File” debug configuration uses:

"program": "${file}"

This attempts to execute files directly using Node.js. However, since this project is written in TypeScript, running .ts or .tsx files directly with Node will fail.

As a result, this configuration is non-functional for most files in the repository and leads to runtime errors during debugging.

⚠️ Root Cause

Node.js does not natively execute TypeScript files

The project relies on tsx (already included as a dependency) for runtime transpilation

The debug configuration does not use tsx, causing execution failures

What did you expect to happen?

Update the configuration to use tsx via npm exec, enabling proper execution of TypeScript files.

{ "name": "CLI: Run Current File", "type": "node", "request": "launch", "runtimeExecutable": "npm", "runtimeArgs": [ "exec", "tsx", "--", "${file}" ], "cwd": "${workspaceFolder}", "skipFiles": ["<node_internals>/"], "outFiles": ["${workspaceFolder}//*.js"], "env": { "NODE_ENV": "development" } } 🚀 Benefits

✅ Enables direct debugging of .ts and .tsx files

✅ Aligns with existing project tooling (tsx)

✅ Removes runtime errors when launching files

✅ Improves developer experience and debugging workflow

Additional context

No response

贡献者指南