hyperledger / fabric-samples

Samples for Hyperledger Fabric
https://wiki.hyperledger.org/display/fabric
Apache License 2.0
2.78k stars 3.37k forks source link

Deploying Typescript Chaincodes Fail using DeployCC.sh In CLI Container for Test Network #591

Open jonmchan opened 2 years ago

jonmchan commented 2 years ago

Using the deployCC.sh script (https://github.com/hyperledger/fabric-samples/blob/main/test-network/scripts/deployCC.sh) from the cli container errors out because npm is not installed. Simple fix - apk add npm.

This fails at:

https://github.com/hyperledger/fabric-samples/blob/main/test-network/scripts/deployCC.sh#L82

Compiling TypeScript code into JavaScript...
/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode-ts /peer
./scripts/deployCC.sh: line 72: npm: command not found
./scripts/deployCC.sh: line 73: npm: command not found
/peer
Finished compiling TypeScript code into JavaScript

Without this the chaincode is deployed improperly and you can easily miss the error message because I believe it tries to package up an empty chaincode package. Another feature that would be useful if the compile fails, the script should halt and not try to continue to publish a bad chaincode package.

davidkel commented 2 years ago

This isn't only applicable to typescript, it also applies to Go and Java chaincode as well which require GoLang/Java to be installed otherwise deployment will fail.

It's not only an issue with the deploy script but also there is no mention of this in the docs or README for samples or test-network

AyushRaj8271 commented 2 years ago

Hey, @davidkel if faced the same while compiling the project on my local machine. I know where what changes are required. Can you assign me this issue? I have a past experience of writing articles.

denyeart commented 2 years ago

@AyushRaj8271 I've assigned to you, thanks for working on a PR!