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

貢獻者指南