我在macOS上遵循了tutorial,并使用these model files升级到v0.0.2。 POST SetupDemo API(curl -X POST --header'Content-Type:application / json'--header'Accept:application / json'-d'{}''http://127.0.0.1:3000/api/SetupDemo')返回
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Error trying invoke business network. Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: transaction returned with failure: ReferenceError: require is not defined",
"stack": "Error: Error trying invoke business network. Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: transaction returned with failure: ReferenceError: require is not defined\n at HLFConnection.invokeChainCode (/Users/jps/.nvm/versions/node/v8.12.0/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:994:30)\n at <anonymous>"
}
}
SetupDemo API确实可以在IBM Cloud BC上运行,而不会出现此错误。
$ node -v
v8.12.0