我正在为我的应用程序使用angular(7)cli。我最近在应用中添加了哨兵集成功能,在构建产品时遇到错误:
ERROR in ./node_modules/@sentry/utils/esm/is.js
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
Error: File lib.dom.d.ts does not have a sourceFile.
at Object.getSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/@angular-devkit/build-optimizer/src/helpers/transform-javascript.js:86:23)
at findSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87549:29)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:85
at getSourceFileFromReferenceWorker (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87424:34)
at processSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:13)
at processRootFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87287:13)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87763:21
at Object.forEach (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:210:30)
at processLibReferenceDirectives (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87758:16)
at findSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87598:17)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:85
at getSourceFileFromReferenceWorker (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87424:34)
at processSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:13)
at processRootFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87287:13)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:86300:60
at Object.forEach (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:210:30)
[31mERROR in ./node_modules/@sentry/utils/esm/misc.js
Module build failed (from ./node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js):
Error: File lib.dom.d.ts does not have a sourceFile.
at Object.getSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/@angular-devkit/build-optimizer/src/helpers/transform-javascript.js:86:23)
at findSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87549:29)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:85
at getSourceFileFromReferenceWorker (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87424:34)
at processSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:13)
at processRootFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87287:13)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87763:21
at Object.forEach (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:210:30)
at processLibReferenceDirectives (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87758:16)
at findSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87598:17)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:85
at getSourceFileFromReferenceWorker (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87424:34)
at processSourceFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87457:13)
at processRootFile (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:87287:13)
at /Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:86300:60
at Object.forEach (/Users/shurikag/PRIZ/dev/priz-fe/node_modules/typescript/lib/typescript.js:210:30)
我怎么了? 我在网上找不到任何可以引导我正确方向的东西。
答案 0 :(得分:9)
降级为哨兵5.6.3解决了该问题。
npm uninstall @sentry/browser -S
npm install @sentry/browser@5.6.3 -S