Decbelief
Decbelief

Reputation: 3

Error when installing chaincode - failed to calculate dependencies: incomplete package

I am try to installing Chaincode, follow the tutorial of hyperledger. But when I try to run the command

peer chaincode install -p chaincodedev/chaincode/sacc -n mycc -v 0

The terminal gives error message

Error: error getting chaincode deployment spec for mycc: error getting chaincode package bytes: failed to calculate dependencies: incomplete package: github.com/hyperledger/fabric-chaincode-go/shim

I see some other people got similar issue, but there is no answer yet. I am new to these stuffs, so any suggestions can be helpful.

Upvotes: 0

Views: 4032

Answers (4)

Vadym
Vadym

Reputation: 747

In my case the reason was incorrect path. CLI container work dir has already chaincodedev part of the path

cli:
    ...
    working_dir: /opt/gopath/src/chaincodedev

You can do following to validate if this is true in your case

docker exec -it cli bash
pwd

You have to see /opt/gopath/src/chaincodedev.

So all I needed to do is just remove chaincodedev from command path

peer chaincode install -p chaincode/sacc -n mycc -v 0

Upvotes: 0

user12994391
user12994391

Reputation: 31

I solved it today:

After loging into CLI contaier execute the following command (import the shim package). This will import the package into cli container where the chaincode will be compiled.

go get github.com/hyperledger/fabric-chaincode-go/shim

then execute

peer chaincode install -p chaincodedev/chaincode/sacc -n mycc -v 0

It will work cheers.

Upvotes: 3

Bhargav
Bhargav

Reputation: 31

Try downloading the shim package to the GOPATH

go get github.com/hyperledger/fabric-chaincode-go/shim

This downloads the shim package to /src/github.com/hyperledger/fabric-chaincode-go/shim inside your GOPATH . Then provide the path to this shim package inside import in your chaincode.

It should be like below:

import ( "github.com/hyperledger/fabric-chaincode-go/shim" )

Upvotes: 1

R Thatcher
R Thatcher

Reputation: 5570

You don't say what version of Fabric and samples you are using, but this looks like a change that was made for Fabric 2.0 and described in the release notes "The shim package and dependencies for go chaincode are no longer included in the chaincode build environment."

There is more detail in the associated Jira entry.

Upvotes: 1

Related Questions