Reputation: 23
I followed the IBM Blockchain Tutorial "A4: Invoking a smart contract from VS Code". I created a demo-contract project with the IBM Blockchain extension as describes in the tutorial with the contract language "TypeScript". But on step A4.4 I can't expand the channels tree in the Fabric Gateways view to show the available transactions.
I am using a Mac with the latest VS Code and IBM Blockchain Extension, as well as the latest Docker Desktop version 3.3.3.
I notices that there is a problem during the deployment of the contract to the "1 Org Local Fabric" environment (for the complete log please see below):
chaincode registration failed: failed to wait on container exit: builder 'node' run failed: exit status 1
In the VSCode Console I am getting also these logs which states that there is a problem with the chaincode invocation:
15.5.2021 16:18:13] [INFO] affectionate_diffie|[ org1peer] 2021-05-15 14:18:13.867 UTC [endorser] callChaincode -> INFO 119 finished chaincode: demo-contract duration: 974ms channel=mychannel txID=c962db53
[15.5.2021 16:18:13] [INFO] affectionate_diffie|[ org1peer] 2021-05-15 14:18:13.867 UTC [endorser] SimulateProposal -> ERRO 11a failed to invoke chaincode demo-contract, error: exit status 1
[15.5.2021 16:18:13] [INFO] affectionate_diffie|[ org1peer] builder 'node' run failed
[15.5.2021 16:18:13] [INFO] affectionate_diffie|[ org1peer] 2021-05-15 14:18:13.867 UTC [endorser] callChaincode -> INFO 119 finished chaincode: demo-contract duration: 974ms channel=mychannel txID=c962db53
[15.5.2021 16:18:13] [INFO] affectionate_diffie|[ org1peer] 2021-05-15 14:18:13.867 UTC [endorser] SimulateProposal -> ERRO 11a failed to invoke chaincode demo-contract, error: exit status 1
[15.5.2021 16:18:13] [INFO] affectionate_diffie|[ org1peer] builder 'node' run failed
In the referenced /tmp/npm-cache/_logs/2021-05-15T14_28_30_384Z-debug.log file within the docker container I see this error:
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /opt/node/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/.bin:/opt/microfab/bin:/opt/fabric/bin:/opt/gradle/bin:/opt/maven/bin:/opt/go/bin:/opt/node/bin:/opt/java/bin:/opt/couchdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle [email protected]~start: CWD: /opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld
10 silly lifecycle [email protected]~start: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'fabric-chaincode-node start "--peer.address=172.17.0.2:2005"'
10 silly lifecycle ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `fabric-chaincode-node start "--peer.address=172.17.0.2:2005"`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/opt/node/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (/opt/node/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld
16 verbose Linux 4.19.121-linuxkit
17 verbose argv "/opt/node/bin/node" "/opt/node/bin/npm" "start" "--" "--peer.address=172.17.0.2:2005"
18 verbose node v12.17.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `fabric-chaincode-node start "--peer.address=172.17.0.2:2005"`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I deleted the "1 Org Local Fabric" environment and removed the Docker container and image "ibmcom/ibp-microfab:0.0.11" and restarted the whole process mutliple times, but the error always appears again.
Please help me what can I do to solve that issue.
Here the complete log from the deployment of the contract to the "1 Org Local Fabric" environment:
[ org1peer] 2021-05-15 15:43:10.424 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0b4 Error: Cannot find module '/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/dist/index.js' command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0b5 Require stack: command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0b6 - /opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/contract-spi/bootstrap.js command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0b7 - /opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/cmds/metadata/lib/generate.js command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0b8 - /opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/cmds/metadata.js command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0b9 - /opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/yargs/index.js command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0ba - /opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/cli.js command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0bb at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0bc at Function.Module._load (internal/modules/cjs/loader.js:842:27) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0bd at Module.require (internal/modules/cjs/loader.js:1026:19) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0be at require (internal/modules/cjs/helpers.js:72:18) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0bf at Function.getInfoFromContract (/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/contract-spi/bootstrap.js:77:23) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c0 at Function.bootstrap (/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/contract-spi/bootstrap.js:54:63) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c1 at Object.exports.handler (/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/cmds/startCommand.js:46:40) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c2 at Object.runCommand (/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/yargs/build/lib/command.js:196:48) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c3 at Object.parseArgs [as _parseArgs] (/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/yargs/build/lib/yargs.js:1043:55) command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c4 at Object.get [as argv] (/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/yargs/build/lib/yargs.js:986:25) { command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c5 code: 'MODULE_NOT_FOUND', command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c6 requireStack: [ command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c7 '/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/contract-spi/bootstrap.js', command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c8 '/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/cmds/metadata/lib/generate.js', command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0c9 '/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/lib/cmds/metadata.js', command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0ca '/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/yargs/index.js', command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0cb '/opt/microfab/data/peer-org1/data/externalbuilder/builds/demo-contract_0.0.1-d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9/bld/node_modules/fabric-shim/cli.js' command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0cc ] command=run
[ org1peer] 2021-05-15 15:43:10.425 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0cd } command=run
[ org1peer] 2021-05-15 15:43:10.436 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0ce npm ERR! code ELIFECYCLE command=run
[ org1peer] 2021-05-15 15:43:10.436 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0cf npm ERR! errno 1 command=run
[ org1peer] 2021-05-15 15:43:10.437 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d0 npm ERR! [email protected] start: `fabric-chaincode-node start "--peer.address=172.17.0.2:2005"` command=run
[ org1peer] 2021-05-15 15:43:10.437 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d1 npm ERR! Exit status 1 command=run
[ org1peer] 2021-05-15 15:43:10.437 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d2 npm ERR! command=run
[ org1peer] 2021-05-15 15:43:10.438 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d3 npm ERR! Failed at the [email protected] start script. command=run
[ org1peer] 2021-05-15 15:43:10.438 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d4 npm ERR! This is probably not a problem with npm. There is likely additional logging output above. command=run
[ org1peer] 2021-05-15 15:43:10.443 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d5 command=run
[ org1peer] 2021-05-15 15:43:10.443 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d6 npm ERR! A complete log of this run can be found in: command=run
[ org1peer] 2021-05-15 15:43:10.443 UTC [chaincode.externalbuilder.node] waitForExit -> INFO 0d7 npm ERR! /tmp/npm-cache/_logs/2021-05-15T15_43_10_439Z-debug.log command=run
[ org1peer] 2021-05-15 15:43:10.448 UTC [lifecycle] Work -> WARN 0d8 could not launch chaincode 'demo-contract_0.0.1:d66596dd67ab1c8de75d7ad3c0ce89d18584a27a4d804b1cb97cda493a13d8d9': chaincode registration failed: failed to wait on container exit: builder 'node' run failed: exit status 1
Upvotes: 1
Views: 945
Reputation: 5868
I'm guessing you selected typescript as the language for your chaincode/contract, and it looks like it didn't transpile the typescript code to javascript. I would suspect there is a build option in the package.json, so try running npm run build
in a vscode terminal in the directory your smart contract is stored (there should be a package.json file in that directory). If that fails because it can't find tsc
then you need to run npm install
first to install all the pre-reqs, then you should be able to run npm run build
.
Once your smart contract has transpiled successfully (there should be in index.js file in the dist directory which is what the error message you posted is complaining about) you should be able to package the chaincode/contract again and install it (you may need to change the version number of your new package before you try to install it again and that's the version
field in your package.json file.
Upvotes: 3