Javascript ES6 TypeError: Class constructor Client cannot be invoked without 'new'

后端 未结 6 714
深忆病人
深忆病人 2020-11-30 02:59

I have a class written in Javascript ES6. When I try to execute nodemon command I always see this error TypeError: Class constructor Client cannot be invo

6条回答
  •  不知归路
    2020-11-30 03:54

    For those who are using ts-node, it could be possible that your tsconfig.json is unable to be loaded by ts-node.
    First make sure you've set the below option for tsconfig.json:

    {
        "compilerOptions": {
            "target": "ES6",
            ...
        }
    }
    

    Then you may try ts-node --script-mode or use --project to specify the path to your tsconfig.json.

提交回复
热议问题