错误 npm failed with exit code 2 错误:命令失败:node_modules/.bin/vsce package --no-yarn

Posted

技术标签:

【中文标题】错误 npm failed with exit code 2 错误:命令失败:node_modules/.bin/vsce package --no-yarn【英文标题】:ERROR npm failed with exit code 2 Error: Command failed: node_modules/.bin/vsce package --no-yarn 【发布时间】:2021-07-29 11:00:29 【问题描述】:

这是 cmd 中显示的确切错误

  TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.

ERROR npm 失败,退出代码为 2 错误:命令失败:node_modules/.bin/vsce package --no-yarn

 at Object.execSync (child_process.js:652:15)
 at CodeUtil.packageExtension (/home/.../out/util/codeUtil.js:180:23)
 at ExTester.<anonymous> (/home/.../out/extester.js:77:27)
 at Generator.next (<anonymous>)
 at /home/.../out/extester.js:18:71
 at new Promise (<anonymous>)
 at __awaiter (/home/.../out/extester.js:14:12)
 at ExTester.installVsix (/home/.../out/extester.js:58:16)
 at ExTester.<anonymous> (/home/.../out/extester.js:112:24)```

'module' flag is already set to 'commonjs' and 'target' is set to 'es6'

【问题讨论】:

【参考方案1】:

现在解决了。 需要在tsconfig.json中添加“test-resources”>“exclude”

【讨论】:

以上是关于错误 npm failed with exit code 2 错误:命令失败:node_modules/.bin/vsce package --no-yarn的主要内容,如果未能解决你的问题,请参考以下文章

npm C:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe` failed with exit code: 1

npm C:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe` failed with exit code: 1

运行代码时报linker command failed with exit code 1 错误

python pcapy 安装错误 link.exe failed with exit status 1120

mongodb启动报错,child process failed, exited with error number 1

出现( linker command failed with exit code 1)错误总结