You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code扩展调试启动失败,提示需设置outFiles属性求助

Fixing "Cannot launch program... setting the 'outFiles' attribute might help" in VS Code Extension Development

Hey there! Let's tackle this error you're hitting while debugging your VS Code extension (especially as you work on your JSON theme).

What does this error mean?

This message pops up because the VS Code debugger can’t locate the compiled JavaScript files it needs to run your extension. Most VS Code extension scaffolds use TypeScript, which gets transpiled to JS and saved to an out folder by default. Even if you’re focused on building a JSON theme, the core extension code from the scaffold still relies on this compiled output. If the debugger can’t find these files—either because they weren’t built yet, or the path in your debug config is incorrect—it throws this error.

How to check your file paths

Let’s start by verifying your debug configuration:

  1. Open .vscode/launch.json in your project root
  2. Check the program field: It should point to your extension’s compiled entry point, typically ${workspaceFolder}/out/extension.js
  3. Check the outFiles field: This should match all compiled JS files in your out folder, e.g., ${workspaceFolder}/out/**/*.js
  4. Confirm the out folder exists in your project—if it doesn’t, your code hasn’t been compiled yet.

Quick Fix Steps

Here’s what to do to resolve this fast:

  • First, manually compile your code: Open your terminal and run npm run compile (this is included in the default extension scaffold’s scripts). You’ll see the out folder appear with your transpiled JS files.
  • Update your launch config: Make sure your .vscode/launch.json has these correct settings (adjust if your project structure differs):
    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Run Extension",
                "type": "extensionHost",
                "request": "launch",
                "runtimeExecutable": "${execPath}",
                "args": ["--extensionDevelopmentPath=${workspaceFolder}"],
                "outFiles": ["${workspaceFolder}/out/**/*.js"],
                "preLaunchTask": "npm: compile"
            }
        ]
    }
    
  • Enable auto-compile: To avoid this issue in the future, turn on TypeScript’s watch mode. Click the TypeScript icon in VS Code’s bottom-right corner, then select "Watch Mode" to automatically recompile code when you save changes.

If you’re working on a pure theme extension with no TypeScript code, you might need to tweak the launch config to skip looking for compiled files—but running the initial compile once should still make the default scaffold work.

内容的提问来源于stack exchange,提问作者Shabbir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 19:42:47