我有一个用Javascript ES6编写的类.当我try 执行nodemon
命令时,我总是看到这个错误TypeError: Class constructor Client cannot be invoked without 'new'
完整错误如下所述:
/Users/akshaysood/Blockchain/fabricSDK/dist/application/Transaction.js:45
return (0, _possibleConstructorReturn3.default)(this, (FBClient.__proto__ || (0, _getPrototypeOf2.default)(FBClient)).call(this, props));
^
TypeError: Class constructor Client cannot be invoked without 'new'
at new FBClient (/Users/akshaysood/Blockchain/fabricSDK/dist/application/Transaction.js:45:127)
at Object.<anonymous> (/Users/akshaysood/Blockchain/fabricSDK/dist/application/Transaction.js:195:14)
at Module._compile (module.js:641:30)
at Object.Module._extensions..js (module.js:652:10)
at Module.load (module.js:560:32)
at tryModuleLoad (module.js:503:12)
at Function.Module._load (module.js:495:3)
at Module.require (module.js:585:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/akshaysood/Blockchain/fabricSDK/dist/routes/users.js:11:20)
我想做的是,我创建了一个类,然后创建了该类的一个实例.然后我试图导出这个变量.
课程 struct 定义如下:
class FBClient extends FabricClient{
constructor(props){
super(props);
}
<<< FUNCTIONS >>>
}
How I am trying to export the variable ->
var client = new FBClient();
client.loadFromConfig(config);
export default client = client;
You can find the full code here > https://hastebin.com/kecacenita.js Code generated by Babel > https://hastebin.com/fabewecumo.js