首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >VSCode扩展:命令'Hello‘导致一个错误(命令'vscode-err-reproduce.helloWorld’未找到)

VSCode扩展:命令'Hello‘导致一个错误(命令'vscode-err-reproduce.helloWorld’未找到)
EN

Stack Overflow用户
提问于 2021-10-04 09:11:58
回答 2查看 1.5K关注 0票数 0

问题描述:

我尝试使用文档中提供的示例扩展(yo代码)创建VS代码扩展。我选择“类型记录”作为它的扩展类型,同时创建它。当我试图运行扩展时,我会收到一条错误消息。

代码语言:javascript
运行
复制
Command 'Hello World' resulted in an error (command 'vscode-err-reproduce.helloWorld' not found)
代码语言:javascript
运行
复制
Activating extension 'undefined_publisher.vscode-err-reproduce' failed: Cannot find module
 '/oct/vscode-extn-ts-error/vscode-err-reproduce/out/extension.js' Require stack: - /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js - /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js.

tsconfig.json

代码语言:javascript
运行
复制
{
    "compilerOptions": {
        "module": "commonjs",
        "target": "ES2020",
        "outDir": "out",
        "lib": [
            "ES2020"
        ],
        "sourceMap": true,
        "rootDir": "src",
        "strict": true   /* enable all strict type-checking options */
        /* Additional Checks */
        // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
        // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
        // "noUnusedParameters": true,  /* Report errors on unused parameters. */
    },
    "exclude": [
        "node_modules",
        ".vscode-test"
    ]
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-10-04 13:29:39

此错误是由于在启动扩展时未运行或未能运行编译造成的。因此,.js文件不能在/out/*目录上创建。

  1. I通过手动运行tsc --从根目录观察--解决了这个问题。我认为,在默认情况下启动扩展会触发编译,但事实并非如此。产品文档中的
  2. 说,“按F5。这将在一个新的扩展开发主机窗口中编译并运行扩展。”但是,对我来说不是这样的。不确定,它实际上是在哪里失败的。
  3. 我已经为这个问题向微软打开了一个bug。

https://github.com/microsoft/vscode-extension-samples/issues/510

票数 3
EN

Stack Overflow用户

发布于 2022-12-02 09:50:08

我在一个子文件夹中创建了这个项目,并得到了这个错误,但是关闭VS代码并重新打开实际的子文件夹对我有效。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69433540

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档