Error in starting hyperledger fabric network with hyperledger composer - npm

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.

Related

Ansible - using npm with a proxy

I have this Ansible code:
- name: Installing project files
shell: |
cd /opt/ewd-server
npm install
become_user: prod-{{SITE}}
Every time I run the code and it reaches that part it keeps saying that the server doesn't have the proxy up. Even thought I executed 2 commands before that:
npm config set https-proxy
npm config set proxy
The values are actually the companies IP's, but redacted for obvious reasons.
The code keeps running until it reaches the 'npm install' task, stays for about half an hour, then Ansible gives the error 'ENOENT'.
NOTE: when I run the npm install command in the server without Ansible it works.
If anyone knows any replacement for npm that works with Ansible, or a solution for this issue please help.
Try configuring the environment variables 'http_proxy' and 'https_proxy':
- name: Installing project files, using a specific proxy
shell: |
cd /opt/ewd-server
npm install
become_user: prod-{{SITE}}
environment:
http_proxy: http://proxy.adres
https_proxy: http://proxy.adres
Of course, edit the proxy values.

Errors when Pushing Vue.js app with IBM Cloud+Cloud Foundry Node Buildpack

I am really new (this is my first time) to using IBM Cloud.I have a Vue.js app that I would like to deploy on IBM Cloud with continuous delivery. I have my Vue project in a GitHub repository, and I would like to be able to deploy the project automatically upon changes to the master branch of the repository. I have successfully set up the tool chain so that the "Delivery Pipeline" runs upon changes to the master branch. See screenshot:
Within the Delivery Pipeline, I have two stages: Build and Deploy. See screenshot 2:
I (think) I have successfully set up the Build Stage, where I install npm, then proceed to run the command "npm run build" to create a deployable bundle, with this script:
bash
#!/bin/bash
export NODE_VERSION=8
export NVM_VERSION=0.33.11
npm config delete prefix \
&& curl -o-
https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}
/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& node -v \
&& npm -v
echo "Installing NPM"
npm install
echo "NPM install successful"
echo "Attempting npm run build"
npm run build
echo "NPM run build successful"
This is where the uncertainty arises. I want to deploy the project, which after npm run build should just require index.hmtl and build.js, which is in the 'dist' folder.
I don't know if this is necessary, but following the npm install and npm run build stage, I added this stage, which I really don't know what does. I have only added it because the boilerplate SDK for Node.js™
had this stage prior to the deploy stage, see screenshot 3:
After this, I have the Deploy stage set to take the 'Simple Build' stage as its input. It deploys it with a simple cloud foundry push command. However, I get these errors in the log, after it downloads the various buildpacks:
Staging...
-----> IBM SDK for Node.js Buildpack v3.25.1-20190115-1637
Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version (latest stable) via 'node-version-resolver'
Installing Node.js (6.16.0) from cache
Using default npm version: 3.10.10
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (package.json)
-----> Installing App Management
WARN: App Management cannot be installed because the start script cannot be found.
To install App Management utilities, specify your 'node' start script in 'package.json' or 'Procfile'.
Checking for Dynatrace credentials
No Dynatrace Service Found (service with substring dynatrace not found in VCAP_SERVICES)
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Build succeeded!
└── vue#2.6.10
! This app may not specify any way to start a node process
http://docs.cloudfoundry.org/buildpacks/node
Exit status 0
Staging complete
Uploading droplet, build artifacts cache...
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (15.3M)
Uploaded droplet (29.4M)
Uploading complete
Stopping instance 64ed3f5f-71eb-477b-afc1-0e07e2e74fdb
Destroying container
Successfully destroyed container
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 crashed
FAILED
Error restarting application: Start unsuccessful
Any ideas? Where am I going wrong? Any help would be greatly appreciated!
Got it working. I just needed to add the dependencies/require statements in the app.js file (some Express stuff), and then I removed that extra 'Simple build" stage

Unable to start hyperledger fabric network with hyperledger composer

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!

NPM not available when running installation script

I have an interesting issue, I have a setup or rails project and the deployment/upgrades works absolutely fine when running as a dedicated user (deploy) who is used to setup everything.
I am using codeDeploy to manage the deployments and it uses root user to do the deployment on AWS, but during the deployment it fails on running the same script because it's not able to find npm command
cd client && npm run build:client
sh: 1: npm: not found
rake aborted!
Command failed with status (127): [cd client && npm run build:client...]
If i run it manually to check that i also get nothing
root#ip-172-31-4-141:/home/ubuntu# su deploy -c "which npm"
root#ip-172-31-4-141:/home/ubuntu#
NPM is available via the deploy user but I am struggling to understand why it's not available via the root user
deploy#ip-172-31-4-141:/home/ubuntu$ which npm
/home/deploy/.nvm/versions/node/v7.8.0/bin/npm
Any help to get this resolved would be great.
Thanks,
The issue here was that AWS CodeDeploy when starts deployment loads only a minimum env; to load all the env variables I have exported the env and then in the deploy phase source that file, which resolves my issue

npm 3.10.10 install socket hang up error

I am using Node 6.10.1 and npm 3.10.10 on a Dell XPS 15 running Ubuntu 16.04 with Kernel 4.13.0.0-36-generic.
I am behind a corporate proxy which is configured through cntlm.
When I run an npm install -d on a project It works from a short time, and after a while I get Error: socket hang up.
I have found numerous questions about my problem but no solution seemed to work.
Here is an extract of a npm config list :
; cli configs
user-agent = "npm/3.10.10 node/v6.10.1 linux x64"
; userconfig /home/msb/.npmrc
https-proxy = "http://localhost:3128/"
registry = "http://urlTocorporateRegistryWhichWorksOnOtherComputers"
strict-ssl = false
; node bin location = /home/msb/.nvm/versions/node/v6.10.1/bin/node
; cwd = /home/msb
; HOME = /home/msb
; "npm config ls -l" to show all defaults.
I cannot change the registry since we are using some internal modules, and I have to keep the current versions of node/npm.
I have already tried :
Using the proxy directly in npm config rather than through cntlm
Limiting my upload/download capabilities with trickle through the command trickle -s -d 100 -u 100 npm install -d
Another indication : It works on Windows, and I have a collegue running Ubuntu 17.04 on a slower pc and it works for him. We think my machine might be a bit too brutal when requesting the registry. Does anyone know a way to slow npm requests ?
It used to work through yarn but some new developments have forced me to go back to npm.
Has anyone encountered and corrected this problem ?
Thanks for your help.
I experimented the same problem, with no apparent reason, on Ubuntu 18.04.
I finally used docker with bind mounts to solve it. The steps are the following:
Create a dockerfile with the following elements (you can also directly run with the used image if you don't need to configure a proxy like me)
FROM node:6.10.1
ENV HTTPS_PROXY "http://yourproxy:yourport/"
# Different RUN commands to configure npm and git corporate proxy
WORKDIR /home/root/
Build the image (from the dockerfile's folder): docker image build -f npm-installer/Dockerfile -t custom-npm-installer .
Go inside the project folder where you would normally run npm install
Run the following command to run the container interactively: docker container run -it --network host -v </host/path/to/pj>:/home/root/pj-to-install --name custom-npm-installer custom-npm-installer bash
You can now run the npm install command from the container. Careful however, you'll then need to use chmod on the node_modules folder recursively since the container uses root by default.
Another thing, if you're using node-sass, it is most of the time compiled on the fly when npm installing, and matches your OS current version/architecture. So if your linux distribution is not exactly the same than the container's you might need to recompile node-sass on your host after running npm install on the container. No worries though, node-sass will give you the command to run the moment you launch your application.