I'm able to deploy business network using hyperledger composer in CentOS linux server but while generating REST apis using composer-rest-server i'm getting connection error?
[root@bctlpblockchain03 ~]#composer network ping -c admin@tutorial-network
The connection to the network was successfully tested: tutorial-network
version: 0.15.2
participant: org.hyperledger.composer.system.NetworkAdmin#admin
Command succeeded
[root@bctlpblockchain03 ~]# composer-rest-server
? Enter the name of the business network card to use: admin@tutorial-network
? Specify if you want namespaces in the generated REST API: never use namespaces
? Specify if you want to enable authentication for the REST API using Passport:
No
? Specify if you want to enable event publication over WebSockets: Yes
? Specify if you want to enable TLS security for the REST API: No
To restart the REST server using the same options, issue the following command:
composer-rest-server -c admin@tutorial-network -n never -w true
Discovering types from business network definition ...
Connection fails: Error: Failed to load connector module "composer-connector-hlf v1" for connection type "hlfv1". Cannot find module '/root/.nvm/versions/node/v8 .9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extension_ binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/version s/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/e xtension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nv m/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/s rc/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module ' /root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modul es/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/n ode_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Ca nnot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest -server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node .node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/comp oser-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/ grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_mod ules/composer-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-l inux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib /node_modules/composer-rest-server/node_modules/grpc/src/node/extension_binary/n ode-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v 8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extension _binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versio ns/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/ extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.n vm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/ src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modu les/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot fin d module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/ node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'
It will be retried for the next request.
Exception: Error: Failed to load connector module "composer-connector-hlfv1" for connection type "hlfv1". Cannot find module '/root/.nvm/versions/node/v8.9.1/li b/node_modules/composer-rest-server/node_modules/grpc/src/node/extension_binary/ node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/ v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extensio n_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versi ons/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node /extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/. nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc /src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_mod ules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot fi nd module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server /node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'- Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-re st-server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_no de.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/co mposer-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x6 4/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_m odules/composer-rest-server/node_modules/grpc/src/node/extension_binary/node-v57 -linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/l ib/node_modules/composer-rest-server/node_modules/grpc/src/node/extension_binary /node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node /v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extensi on_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/vers ions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/nod e/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/ .nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grp c/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find modul e '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_mo dules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'
Error: Failed to load connector module "composer-connector-hlfv1" for connection type "hlfv1". Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modu les/composer-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-li nux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/ node_modules/composer-rest-server/node_modules/grpc/src/node/extension_binary/no de-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8 .9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extension_ binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/version s/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/e xtension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nv m/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/s rc/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module ' /root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modul es/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/n ode_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node'-Ca nnot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest -server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node .node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_modules/comp oser-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/ grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib/node_mod ules/composer-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-l inux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v8.9.1/lib /node_modules/composer-rest-server/node_modules/grpc/src/node/extension_binary/n ode-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versions/node/v 8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extension _binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.nvm/versio ns/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/ extension_binary/node-v57-linux-x64/grpc_node.node'-Cannot find module '/root/.n vm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/grpc/ src/node/extension_binary/node-v57-linux-x64/grpc_node.node'
at Promise.resolve.then (/root/.nvm/versions/node/v8.9.1/lib/node_modules/co mposer-rest-server/node_modules/composer-common/lib/connectionprofilemanager.js: 136:42)
at <anonymous>
you need to rebuild it
go to the folder first
(into the folder where you have 'composer-rest-server')
then
It will work now
When I tried the command:
npm rebuild --unsafe-prem
It threw me an error saying
Warning "root" does not have permission to access the dev dir
.I just added
sudo
and it worked well for me!:sudo npm rebuild --unsafe-prem
All the above solution works fine, but they are temporary fixed. I had the same problem and I used the
sudo npm rebuild --unsafe-prem
solution. The problem did go away for a while, but I kept running into it again and again.I read the documentation again @ https://hyperledger.github.io/composer/latest/installing/installing-prereqs.
**If installing Hyperledger Composer using Linux, be aware of the following advice:
Doing this will really help you in long run, Goodluck !
In my case the problem was "node-v57-linux-x64" I had "node-v59-linux-x64" and I solved it in the following way:
then
It worked for me the two times I had the error