0
votes

I am following the Bluemix Blockchain tutorial learn-chaincode in GitHub (https://github.com/IBM-Blockchain/learn-chaincode), but it fails when doing the initial build.

The error message is:

/d/work/src/github.com/learn-chaincode/start (master)
$ go build ./
chaincode_start.go:23:2: cannot find package "github.com/hyperledger/fabric/core/chaincode/shim" in any of:
        D:\opt\Go\src\github.com\hyperledger\fabric\core\chaincode\shim (from $GOROOT)
        D:\work\src\github.com\hyperledger\fabric\core\chaincode\shim (from $GOPATH)

I followed the initial set up of setting up my environment:

$ go get github.com/hyperledger-archives/fabric/tree/v0.5-developer-preview/core/chaincode/shim
package github.com/hyperledger-archives/fabric/tree/v0.5-developer-preview/core/chaincode/shim: cannot find package "github.com/hyperledger-archives/fabric/tree/v0.5-developer-preview/core/chaincode/shim" in any of:
        D:\opt\Go\src\github.com\hyperledger-archives\fabric\tree\v0.5-developer-preview\core\chaincode\shim (from $GOROOT)
        D:\work\src\github.com\hyperledger-archives\fabric\tree\v0.5-developer-preview\core\chaincode\shim (from $GOPATH)

The result is that it populates the directory hyperledger-archives.

$ ls $GOPATH/src/github.com/hyperledger-archives/fabric/
bddtests/        docs/      LICENSE          peer/      sdk/
consensus/       events/    MAINTAINERS.txt  protos/    tools/
CONTRIBUTING.md  examples/  Makefile         pub/       TravisCI_Readme.md
core/            gotools/   membersrvc/      README.md  vendor/
devenv/          images/    mkdocs.yml       scripts/

But as you can see there is no D:\work\src\github.com\hyperledger-archives\fabric\tree.

What am I doing wrong?

1

1 Answers

0
votes

Ensuring that Hyperledger Fabric is located within the GOPATH directory could resolve this issue. The Learn Chaincode tutorial (https://github.com/IBM-Blockchain/learn-chaincode) references a prerequisite “Chaincode Development Environment” section: https://github.com/IBM-Blockchain/learn-chaincode/blob/v1.0/docs/setup.md

The “Instructions” heading of the “Chaincode Development Environment” section mentions an error that is almost identical to the following error that was observed.

    $ go build ./
    chaincode_start.go:23:2: cannot find package "github.com/hyperledger/fabric/core/chaincode/shim" in any of:
    D:\opt\Go\src\github.com\hyperledger\fabric\core\chaincode\shim (from $GOROOT)
    D:\work\src\github.com\hyperledger\fabric\core\chaincode\shim (from $GOPATH)

The cause of the error could be that the Hyperledger Fabric was not installed properly in the GOPATH.