question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 7 - Class constructor ErrorHandler cannot be invoked without 'new'

See original GitHub issue

Hi,

We’ve recently upgraded to angular 7 and typescript 3.2.4

We’ve followed the instructions here: https://docs.bugsnag.com/platforms/javascript/angular/

But we are getting the following error:

TypeError: Class constructor ErrorHandler cannot be invoked without 'new'
    at new BugsnagErrorHandler (index.js:15)
    at errorHandlerFactory (app.module.ts:78)
    at _callFactory (core.js:27000)
    at _createProviderInstance (core.js:26943)
    at initNgModule (core.js:26846)
    at new NgModuleRef_ (core.js:27978)
    at createNgModuleRef (core.js:27961)
    at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.js:30474)
    at NgModuleFactory_.create (core.js:31572)
    at ngZone.run (core.js:22412)

Line 15 being: image

Might be related to this - https://github.com/bugsnag/bugsnag-js/issues/482

Anyone else having this issue?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
tomarderncommented, Jun 25, 2020

Updating to the new bugsnag library fixes this.

Thanks!

0reactions
suikast42commented, Aug 18, 2020

go to tsconfig.json file and change your target to es5 (ECMAScript 5) like this :

{ “compileOnSave”: false, “compilerOptions”: { “baseUrl”: “./”, “outDir”: “./dist/out-tsc”, “sourceMap”: true, “declaration”: false, “module”: “esnext”, “moduleResolution”: “node”, “emitDecoratorMetadata”: true, “experimentalDecorators”: true, “importHelpers”: true, “target”: “es5”, “typeRoots”: [“node_modules/@types”], “lib”: [“es2018”, “dom”] } }

U save my day

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class constructor cannot be invoked without 'new' in TS
The "Class constructor cannot be invoked without new" error occurs when the target property in tsconfig.json is set to lower than es6 or...
Read more >
angular - class constructor cannot be invoked without 'new
I am trying to use a 3rd party typescript library(antlr - https://github.com/tunnelvisionlabs/antlr4ts) in my angular 2 project created using ...
Read more >
Angular script compilation: TypeError: Class constructor ...
Hi there, We are running a project in an Ionic/Angular app, ... TypeError: Class constructor MyScript cannot be invoked without 'new' at ...
Read more >
Javascript ES6 TypeError Class constructor Client cannot be ...
When I try to execute nodemon command I always see this error TypeError: Class constructor Client cannot be invoked without 'new'.
Read more >
class constructor cannot be invoked without 'new' angular ...
TypeError : Class constructor Home cannot be invoked without 'new' ; 1. import React, { Component } from 'react' ; 2. import {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found