Unable to start hyperledger fabric network with hyperledger composer - npm

I am currently working on HyperLedger composer v1.1 on Ubuntu Virtual Machine (16.04 LTS) hosted in remote server and using VMWare Vsphere client to connect to that host machine. My PC (Windows 7) and the hosting server are in the same LAN.
In fact, I am following the tutorial (https://hyperledger.github.io/composer/latest/tutorials/developer-tutorial).
I managed to install the chaincode onto the network but when I tried to start the business network using the command :
composer network start --networkName tutorial-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
I got this error :
✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/composer-runtime-hlfv1 failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443 ...."
Then, when I saw the suggestion of #PaulO'Mahony at "hyperledger-composer v1.1:unable to instantiate chaincode"
I tried to locate the npmrc file but it was not there then I did as #oligofren suggested at Node .npmrc file.
After that, I have executed this command :
composer network install --c PeerAdmin#hlfv1 --a tutorial-network#0.0.1.bna -o npmrcFile=/home/user1/.npmrc"
where ".npmrc" file is generated after I have logged in (using npm login).
Finally, when try to execute the above command "composer network start...." the same error is still exist !!!
Note that : I have executed "./stopFabric.sh", "./teardownFabric.sh" and then "./startFabric.sh" before I did each solution!

Related

Cannot load a package using NPM - local certificate error

Apologies if this is a repeat question, but I am new to this. I have installed nodeJS and am trying to install hardhat. I have a Windows 10 laptop.
I followed the instructions here: https://hardhat.org/tutorial/setting-up-the-environment
I am trying to run the following code:
mkdir hardhat-tutorial
cd hardhat-tutorial
npm init --yes
npm install --save-dev hardhat
Then I get the following errors:
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/hardhat failed, reason: unable to get local issuer certificate
When I search this online it says to try the following solutions:
npm config set strict-ssl false
OR
npm config set registry http://registry.npmjs.org/
I've done both and rebooted the PC and it doesn't make a difference. Anyone got any ideas of what I can do to resolve this?
Thanks
John
You are running from behind a "deep inspection" web proxy, which issues fake SSL certificates to allow it to inspect your traffic, and although there are probably automated systems to make your browser trust the root CA cert that issues these certificates, npm is not configured to trust that CA.
You should be able to get the CA cert from your browser, the system keychain, or your IT department, and then configure npm to use it with npm config set cafile /path/to/cert.pem
even if you don't know where the corporate certificate is located you can solve it for a single terminal use by running set NODE_TLS_REJECT_UNAUTHORIZED=0 before running the npm commands it will work for the current terminal session.
or you can run setX NODE_TLS_REJECT_UNAUTHORIZED 0 /m once
beware this option as security risks!
to cancel this setting you should run REG delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /F /V NODE_TLS_REJECT_UNAUTHORIZED .
the best way to solve the problem will be to find the corporate certificate and run the following command SetX NODE_EXTRA_CA_CERTS "path/to/certificate" /m when you change path/to/certificate by the full path.
Turning off strict ssl: npm config set strict-ssl=false
Changing the registry to http instead of https: npm config set registry http://registry.npmjs.org/
Changing my cafile setting: npm config set cafile /path/to/your/cert.pem
Stop rejecting unknown CAs: set NODE_TLS_REJECT_UNAUTHORIZED=0

How to configure npm proxy for the company's Zscaler settings?

0
In my company I can't download the node modules via npm, because the connection is being refused. We use a Zscaler with a .pac config file. I tried to configure the proxy via various tutorials
Is there a way to make npm install (the command) to work behind proxy?
https://www.jhipster.tech/configuring-a-corporate-proxy/
but I don't get it to work. When I type
npm --proxy http://username:password#cacheaddress.com.br:80 install packagename
it tells me "event not found", when I type the password. If I leave the password field empty, I get
npm ERR! 418 I'm a teapot - GET http://registry.npmjs.org/electron - got unknown host (registry.npmjs.org:80)

Install Angular CLI Offline trys to connect

I am attempting to install Angular CLI in an offline environment using cache. The approach I am using is
1. copy the npm-cache folder from %appdata% folder ( from my online machine which has Angular already installed)
2. Place it in my offline machine.
3. Run this command to install angular cli from cache:
npm i #angular/cli -g --cache MY_CACHE_FOLDER --cache-min 999999999 --no-shrinkwrap
I receive the following error:
FetchError: request to https://registry.npmjs.org/#angular%2fcli failed, reason: connect ECONNREFUSED 104.16.22.35:443
My question is, why is npm trying to look online, when I specified to use cache?

Error in starting hyperledger fabric network with hyperledger composer

I am trying to set up a network using hyper ledger composer, for which I followed the
Developer tutorial for creating a Hyperledger Composer solution
but when I use the command
composer network start --networkName tutorial-network --networkVersion
0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
It is giving the following error :
Starting business network tutorial-network at version 0.0.1
Processing these Network Admins: userName: admin
✖ Starting business network definition. This may take a minute...
**Error: Error trying to start business network. Error: No valid responses from any peers.** Response from attempted peer comms was an error: **Error: 2 UNKNOWN: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm ERR!** code EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR! request to https://registry.npmjs.org/composer-runtime-hlfv1 failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-04-10T10_10_13_361Z-debug.log " Command failed
I have tried tearing down the fabric and starting the fabric again but it didn't help.
Are you behind a proxy / firewall ? If so in the composer network install command you require a -o npmrcFile parameter, to resolve the NPM registry. eg registry=https://mycompanynpmregistry.com:4873 (or the resolved IP address) as in composer network install -c PeerAdmin#hlfv1 -a digitalproperty-network.bna -o npmrcFile=/tmp/npmrcFile . See https://hyperledger.github.io/composer/latest/managing/connector-information
If you are finding that you get a REQUEST_TIMEOUT on a start or upgrade request, you could try increasing the timeout of the fabric default for startup timeout.
If you are using our simple Hyperledger Composer development server environment from composer-tools github repo, then you can add the following to the peer definition to see if it addresses the problem:
CORE_CHAINCODE_STARTUPTIMEOUT=1200s
in the file ~/fabric-tools/fabric-scripts/hlfv11/composer/docker-compose.yml
eg, the above is a snippet from the peer definition. You would have to do a docker-compose stop - then docker-compose start from that directory location to take effect.
Footnote:
In addition to CORE_CHAINCODE_STARTUPTIMEOUT change above - you MUST ALSO UPDATE the timeout values to match (ie CORE_CHAINCODE_STARTUPTIMEOUT), in the connection.json file for the card(s) that performs the composer network start command (eg. PeerAdmin card in $HOME/.composer). You will see 4 timeouts (3 for a Peer and 1 for the Order) in the 'client' section, under the stanza "connection". By default, these are set to 300 seconds - Increase the value to 1200 for each. Do note that CORE_CHAINCODE_STARTUPTIMEOUT must have the 'trailing s' , whereas these 4 timeouts defined above - don't have this.
1) I had the same error while starting the network. This solution helped me: https://github.com/hyperledger/composer/issues/3591#issuecomment-386718739
It states the following:
There is an extra character when you copy the string from hyperledger
composer website.
Try copy pasting the following line to a notepad and paste in the
command line. It will work.
composer network start --networkName tutorial-network
--networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
2) If it doesn't help, then try to kill any stale or active docker containers.
Run the following command to kill any stale or active containers:
docker rm -f $(docker ps -aq)
Clear any cached networks:
Press y when prompted by the command
docker network prune
Then, go to ~/fabric-dev-servers folder and run the commands:
cd ~/fabric-dev-servers
./teardownFabric.sh
./startFabric.sh
./createPeerAdminCard.sh
After that, run the composer network install command:
composer network start --networkName tutorial-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
I had same error, I found out that the pre-requisities that I have already installed in my system didnot matched the versions. So I uninstalled the pre-requisities and reinstalled them. In my case the version of docker was creating a problem.

Socket.io NPM install error specific to AWS Elastic Beanstalk

It appears that socket.io is causing my an NPM install error on AWS Elastic Beanstalk.
I deploy to EB no problem. I add socket.io to my package.json and deploy to EB I get an error. I remove it and it passes again.
I add socket.io via npm i socket.io --save, and the lines that's added to package.json is "socket.io": "^2.0.4"
I am able to reliably cause this failure or repair the issue by simply removing the above line from package.json or adding it back in. Any ideas on what the culprit could be?
I'm using the same node version locally and on aws
It's hard to track down the specifics of the error but here is the output from eb-activity.log
Running npm install:
/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/npm
Setting npm config jobs to 1 npm config jobs set to 1 Running npm
with --production flag Failed to run npm install. Snapshot logs for
more details. Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/npm',
'--production', 'install']' returned non-zero exit status 1
(Executor::NonZeroExitStatus)
[2018-01-19T20:30:59.814Z] INFO [3067] - [Application update
shippable.lowy-api-dev.develop.111#42/AppDeployStage0/AppDeployPreHook/50npm.sh]
: Activity failed. [2018-01-19T20:30:59.814Z] INFO [3067] -
[Application update
shippable.lowy-api-dev.develop.111#42/AppDeployStage0/AppDeployPreHook]
: Activity failed. [2018-01-19T20:30:59.814Z] INFO [3067] -
[Application update
shippable.lowy-api-dev.develop.111#42/AppDeployStage0] : Activity
failed.
I'm using node v 6.11.5 on Elastic Beanstalk and socket.io 2.0.4
Update; following the instructions from https://gist.github.com/jmar777/9281403 I SSH into my Elastic Beanstalk instance and manually run the npm install. Everything passes normally without error! The pre-install output is identical to the above error logs, but it runs just fine.
Why would I get that error when Elastic Beanstalk runs the install but not manually?