Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: File lib.dom.d.ts does not have a sourceFile

I am using angular(7) cli for my app. I recently added sentry integration into the app and when I build prod I am getting an error:

    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)

What am I going wrong? I didn't find anything on the web that directed me to the right direction.

like image 688
Shurik Agulyansky Avatar asked Oct 23 '19 11:10

Shurik Agulyansky


1 Answers

Downgrading to sentry 5.6.3 resolved the issue.

  1. npm uninstall @sentry/browser -S
  2. npm install @sentry/[email protected] -S
like image 125
Amit Kumbharkar Avatar answered Oct 13 '22 13:10

Amit Kumbharkar