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.

TypeError: Class constructors cannot be invoked without 'new'

See original GitHub issue

Trying to test koa 2 alpha, getting this error:

constructor() {
10/28/15 06:20:06
aidax-collector-1 aidax[1491]: ^
10/28/15 06:20:06
aidax-collector-1 aidax[1491]: TypeError: Class constructors cannot be invoked without 'new'
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at require (module.js:384:17)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at normalLoader (/app/releases/20151028201122/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at startup (node.js:117:18)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Function.Module.runMain (module.js:475:10)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module._compile (module.js:434:26)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Object.Module._extensions..js (module.js:452:10)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module.load (module.js:355:32)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Function.Module._load (module.js:310:12)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Object.<anonymous> (/app/releases/20151028201122/node_modules/koa-cluster/lib/http.js:9:11)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at require (module.js:384:17)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module.require (module.js:365:17)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Function.Module._load (module.js:310:12)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module.load (module.js:355:32)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Object.<anonymous> (/app/releases/20151028201122/index.js:6:1)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module._compile (module.js:434:26)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Object.Module._extensions..js (module.js:452:10)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at node.js:951:3
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module.require (module.js:365:17)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module.load (module.js:355:32)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Function.Module._load (module.js:310:12)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Object.require.extensions.(anonymous function) [as .js] (/app/releases/20151028201122/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
10/28/15 06:20:05
aidax-collector-1 aidax[1491]: at Module._compile (module.js:434:26)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
felixfbeckercommented, Oct 28, 2015

In koa2 you need to do const app = new Koa() instead of const app = koa()

2reactions
mgthomas99commented, Sep 11, 2017

@julie1013 You’ve got a syntax error.

class Cow extends FarmAnimal(){
                            ^^

The parentheses shouldn’t be there.

EDIT: Just noticed this was over a year ago.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class constructor Client cannot be invoked without 'new' - ...
When I try to execute nodemon command I always see this error TypeError: Class constructor Client cannot be invoked without 'new'.
Read more >
Typescript: TypeError: Class constructor cannot be invoked ...
Bug report. Getting the following error in my project: TypeError: Class constructor cannot be invoked without 'new'.
Read more >
Javascript ES6 TypeError Class constructor Client cannot ...
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 SweetAlert cannot be invoked without ...
Uncaught TypeError: Class constructor SweetAlert cannot be invoked without 'new' ... Hi,. After updating meteor version, I can not use the ...
Read more >
Reactjs " Class constructor upload cannot be invoked ...
Uncaught TypeError: Class constructor Upload cannot be invoked without 'new'. i dont know what to do with it:
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