问题描述:
我尝试使用文档中提供的示例扩展(yo代码)创建VS代码扩展。我选择“类型记录”作为它的扩展类型,同时创建它。当我试图运行扩展时,我会收到一条错误消息。
Command 'Hello World' resulted in an error (command 'vscode-err-reproduce.helloWorld' not found)
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
{
"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"
]
}
发布于 2021-10-04 13:29:39
此错误是由于在启动扩展时未运行或未能运行编译造成的。因此,.js文件不能在/out/*目录上创建。
https://github.com/microsoft/vscode-extension-samples/issues/510
发布于 2022-12-02 09:50:08
我在一个子文件夹中创建了这个项目,并得到了这个错误,但是关闭VS代码并重新打开实际的子文件夹对我有效。
https://stackoverflow.com/questions/69433540
复制相似问题