Welcome to the Linux Foundation Forum!

How to install chaincode behind a proxy?

Hi everyone,

I was following lab 4.1 and got an issue while installing the chaincode on the peers. The error is shown below:

$ peer lifecycle chaincode install simple_chaincode.tar.gz
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "+ INPUT_DIR=/chaincode/input

  • OUTPUT_DIR=/chaincode/output
  • cp -R /chaincode/input/src/. /chaincode/output
  • cd /chaincode/output
  • '[' -f package-lock.json -o -f npm-shrinkwrap.json ]
  • npm install --production
    npm ERR! code ENOTFOUND
    npm ERR! errno ENOTFOUND
    npm ERR! network request to https://registry.npmjs.org/fabric-contract-api failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
    npm ERR! network This is a problem related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad network settings.
    npm ERR! network
    npm ERR! network If you are behind a proxy, please make sure that the
    npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-03-14T18_25_36_301Z-debug.log
"

I looked for possible ways of setting the proxies and found a solution here but I could not find out whether I have to create my own Dockerfile and build a custom image after adding the proxy or which existing files to edit and what should I tag that custom image as hyperledger/fabric-ccenv:latest ? I am also open to any alternate ways of resolving this.

Thanks

Answers

  • aksh017
    aksh017 Posts: 2

    I also tried to do npm install before packaging the chaincode so that the dependencies get packaged together with the chaincode but I get this error:

    $ peer lifecycle chaincode install simple_chaincode.tar.gz
    Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "+ INPUT_DIR=/chaincode/input

    • OUTPUT_DIR=/chaincode/output
    • cp -R /chaincode/input/src/. /chaincode/output
    • cd /chaincode/output
    • '[' -f package-lock.json -o -f npm-shrinkwrap.json ]
    • npm ci '--only=production'
      npm ERR! code ENOTFOUND
      npm ERR! errno ENOTFOUND
      npm ERR! network request to https://registry.npmjs.org/fabric-contract-api/-/fabric-contract-api-2.2.2.tgz failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
      npm ERR! network This is a problem related to network connectivity.
      npm ERR! network In most cases you are behind a proxy or have bad network settings.
      npm ERR! network
      npm ERR! network If you are behind a proxy, please make sure that the
      npm ERR! network 'proxy' config is set properly. See: 'npm help config'

    npm ERR! A complete log of this run can be found in:
    npm ERR! /root/.npm/_logs/2022-03-14T23_59_56_571Z-debug.log
    "

    It is using npm ci '--only=production' which will remove the existing node_modules and try to install all the dependencies again which gives the same proxy issue.

Categories

Upcoming Training