我使用Node.js API编写了链代码,现在我试图实例化。
图片:hyperledger / fabric-peer:1.4.5
我的package.json具有以下来源:
{
"name": "democontract",
"version": "1.0.0",
"description": "Document Contract",
"main": "index.js",
"engines": {
"node": ">=8.4.0",
"npm": ">=5.3.0"
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"start": "fabric-chaincode-node start",
"mocha": "mocha test --recursive"
},
"engine-strict": true,
"license": "Apache-2.0",
"private": true,
"dependencies": {
"mkdirp": ">=0.5.5",
"openpgp": "^4.10.0",
"fabric-chaincode-api": "^1.4.0",
"fabric-shim": "^1.4.0"
},
"devDependencies": {
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"eslint": "^4.19.1",
"mocha": "^5.2.0",
"nyc": "^12.0.2",
"sinon": "^6.0.0",
"sinon-chai": "^3.2.0"
}
}
但是当我在CLI容器中调用以实例化链码(democontract)时:
peer chaincode instantiate -C $CHANNELNAME -n $CHCODENAME -v $CHCODEVERSION -o $ORDERERNAME \
-c '{"Args":["ContractDocument:instantiate"]}' \
-P "OR('OrdererMSP.admin','Org1MSP.admin','Org1MSP.peer','Org1MSP.member')" \
--tls --cafile $ORDERER_TLSCACERT --tlsRootCertFiles $CORE_PEER_TLS_ROOTCERT_FILE
我在PEER容器中接收到以下错误,并且链码无法实例化。
我不知道如何摆脱这种错误情况。 拜托,你能帮我吗?
[endorser] SimulateProposal -> ERRO 050 [devchannel][bef25398] failed to invoke chaincode name:"lscc" , error: Failed to generate platform-specific docker build:
Error returned from build: 1 "npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported.
Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm ERR! code E404
**npm ERR! 404 Not Found - GET https://registry.npmjs.org/fabric-chaincode-api - Not found**
npm ERR! 404
npm ERR! 404 'fabric-chaincode-api@^1.4.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'output'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-18T19_31_20_461Z-debug.log
"
error starting container
error starting container
关于, Magno A. Cavalcante
答案 0 :(得分:0)
您可能正在使用不兼容版本的节点js。请使用超级账本结构版本检查节点js的受支持版本。
答案 1 :(得分:0)
问题出在 package.json 内部。
代码段错误:
"dependencies": {
"mkdirp": ">=0.5.5",
"openpgp": "^4.10.0",
"fabric-chaincode-api": "^1.4.0",
"fabric-shim": "^1.4.0"
},
正确的代码段是:
"dependencies": {
"mkdirp": ">=0.5.5",
"openpgp": "^4.10.0",
"fabric-contract-api": "^1.4.3",
"fabric-shim": "^1.4.3"
},
从 fabric-chaincode-api 更改为 fabric-contract-api 。
我参考URL https://hyperledger.github.io/fabric-chaincode-node/master/api/tutorial-using-contractinterface.html中描述的软件包编写了package.json。
有关将来的参考,请参见下面的URL: