Reputation: 13
I'm following the official document: https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
I am building my first network. But when I instantiate the node version chaincode, because my machine is working behind the proxy, NPM always throws network exception to me.
I have tried setting proxy in the package.json or scripts, but it does not work.
How can I avoid this?
For example, if I execute:
./byfn.sh -c mychannel -l go up
it works well.
But, if I execute:
./byfn.sh -c mychannel -l node up
It would throw an exception because the container doesn't have the internet access to download the node module or else...
Upvotes: 1
Views: 961
Reputation: 5140
I think your best bet is to modify the chaincode docker image used for building to to have npm preconfigured with a proxy via:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
To modify it, you can just prefix "RUN" before the npm commands above in the docker image template that is used to create the docker file in which the chaincode is built:
RUN npm config set proxy http://proxy.company.com:8080
RUN npm config set https-proxy http://proxy.company.com:8080
At node.js chaincode build time, the following commands are run:
cp -R /chaincode/input/src/. /chaincode/output && cd /chaincode/output && npm install --production
Upvotes: 5