I am working on Hyperledger fabric project and while running command node generateFights.js i am receiving the below error.
Error: Connection is not in the READY state at ChannelEventHub._checkConnection
I downloaded the source from HyperLedger Fabric API to my local directory.
I open the directory in VisualStudio and run the command, but it throws me an error.
Just to be sure: -
1. Docker Process is working. (Docker ps)
2. I have composer version installed ( v.0.19.0)
3. Node version - 8.11.1
What I tried to solve the issue: -
I begin the ./startFabric.sh
I installed the new network and started the process.
Imported the newly generated card.
Please suggest me what i need to do or learn to solve this issue.
The error "Connection is not in a READY state" has been seen a few times as a result of an underlying grpc problem. grpc v1.11.0 causes Composer to fail with this error, but v10.0.1 seems to be OK. More details are described and workarounds are described in this github issue.
It is likely that your app requires or has a dependency on a Composer client version with the grpc problem. If you remove your Node modules folder and examine your package.json file you should be able to fix the version problem
This issue has been addressed in the 1.1.2 release of the hyperledger fabric node sdk so you should ensure that your package.json dependencies will download this version and also ensure you clean up your node_modules directory and re-install your dependencies using npm install.
For Hyperledger composer users, v0.19.4 and beyond addresses this problem.
Go to directory in which composer-rest-server and composer-cli npm modules are installed, then install the grpc npm module with version 1.10.1.
Run the below command from both directories:
npm install --save grpc#1.10.1
It will solve your problem.
NOTE: In my case, node modules were installed at
/home/user_name/.npm-global/lib/node_modules/. That is my global directory for npm.
Related
I have an angular project that comes with a package.json file and all the dependencies listed within, but each time I run "npm install", in the terminal, the packages appear to be downloading properly and a node module folder is created in my root folder, but at a certain stage the installation stops without an error message and the generated node module folder disappear from my project. please what do I do?
I can't reproduce your situation, somehow this may not fitable for you.
But I suggest re-install node.js to make sure npm install work correctly.
This link will help to find what version of node.js for you, based on you angular version.
Compatibility list for Angular/Angular-CLI and Node.js
Also, It would be good to manage node.js via NVM(Node Version Manager).
My node app will deploy in a bank that can't access the internet. Can I download all the node modules in a local directory, and install them from it, or just copy the node_modules to the bank machines? Any safe and practical advise will be highly appreciated, thank you.
OR
How to add node_modules dependencies without using internet .
Add offline-npm to your project to serve a npm compatible tgz file wich contains all dependencies for offline installation with npm install.
Additionally you can use offline-npm -n to install packages from your local npm cache directory
For installation
npm install -g offline-npm
Usage
1) Open terminal and go to your project you want to prepare for offline use. This folder needs to contain a package.json file.
2) Prepare your project for offline use
offline-npm --add
3) This changes the package.json file and adds a offline folder which will contain all your dependencies.
Pack your project
npm pack
For more details , visit the Link
Hope this answer gets useful to you .
Typically you will want to bundle your node_modules into your deployable artifact.
There are some gotchas here around any native dependencies as you need to match the nodejs version of the build environment with the target system.
The easiest way to achieve this in my experience is by using docker to build and package your deployment. Though it is possible to do when running directly on host machines, you may find it safest to just avoid the usage of native dependencies to remove any risk of things breaking from a nodejs or os update.
I've also successfully achieved this packaging the nodejs binary into my deployment artifact that was deployed directly on centos hosts, however we had a mixture of centos 6 and centos 7 hosts at the time, which brought additional complexity related to different glibc versions causing nodejs to fail to start with the system provided library.
In short if you can I would use docker to package your application into a completely self contained image.
you can just copy the node_modules into the deployment machine but it is bad practice.
there are other solutions like using local-npm package... your npm installs are fetched from the registry and then modules and their dependencies get stored in a local PouchDB database. This caches them so subsequent npm installs use the local cache rather than calling to the network. local-npm also takes care of keeping modules updated when they change. It does this by listening for changes to the remote registry so you don't have to worry about staleness.
or bundling your packages to use them offline you could visit this link for more details for offline installation of npm packages:
https://addyosmani.com/blog/using-npm-offline/
How to install node modules in local network?
1. Solution: yarn offline and 'Offline Mirro'
One of the main advantages of Yarn is that it can install node_modules from files located in file system. We call it “Offline Mirror” because it mirrors the files downloaded from registry during the first build and stores them locally for future builds.
2. New problem: How to use yarn in local network?
Download yarn.tar.gz into the local repository, and install it in local node_modules directory.
npm install yarn.tar.gz --no-save
3. Usage
# run yarn install, and download the node modules (.tar.gz) into the offline mirror directory '$REPOSITORY/yarn/yarn-offline-mirror'.
npm run online-install
# with yarn.lock file, install node_modules from offline mirror directory '$REPOSITORY/yarn/yarn-offline-mirror'
npm run offline-install
4. Problems
4.1. problem 1
4.1.1. description
error can`t make a request in offline mode("http://....")
4.1.2. reason
the indirect dependencies could not be downloaded into offline mirror directory
4.1.3. resolution
yarn config set yarn-offline-mirror-pruning false
5. Github demo
yarn-offline-deploy-demo
6. Reference
1. Running Yarn offline
I am getting the following error while running the fabcar sample hyperledger fabric example:
Error: Cannot find module 'fabric-network'
I have deleted my node_modules directory and afterwards ran an npm install to get all my project dependencies.
Any ideas on what else to try? Any help would be greatly appreciated!
Perhaps fabric-network isn't listed as a dependency within your package.json file so this dependency isn't installed within your node_modules directory when you ran an npm install. Maybe you could do the following:
npm i --save fabric-network
This will install the fabric-network module within your node_modules directory as well as update your package.json file to list this module as a dependency for your project.
Hopefully that helps!
To create a sample smart contract, I have followed the process in the link below:
https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform
In the step of 'Package a smart contract project,' the following error occurred:
[ERROR] Error: ENOENT: no such file or directory, stat '/Users/..../node_modules/.bin/fabric-chaincode-node'
Under the /.bin directory, actually the fabric-chaincode-node is not found. Is the fabric code verson/release in my environment not met to what VSCode extension requires?
I uninstalled node version 10 and installed node version 8. Create the contract again and re build package . It worked for me
It really looks for the module under ./bin
Thus, try installing fabric-shim module manually using npm i fabric-shim.
Run below two command in Chaincode
nvm use v8.17.0
npm install
I'm trying to setup hyperledger fabric in my windows 10 system. While installing the pre-requisites mentioned in the fabric's documentation I couldn't install the global build tools. I tried running the command:
npm install --global windows-build-tools
but the installation gets stuck at:
successfully installed Python 2.7 and it stops at rpc connection was closed.Stream was closed.
I also followed the following youtube tutorial but still facing the same problem. The reference link:
https://www.youtube.com/watch?v=7BeJ6MSKH9k&t=457s
Update: It works by changing the command to
npm install --global windows-build-tools#4.0.0
Seems the problem is with the latest version of build tools. Some compatibility issue.