panchu.prodhan
panchu.prodhan

Reputation: 13

error after typing "node enrollAdmin.js" on windows

node enrollAdmin.js

error: [FabricCAClientService.js]:  Failed to enroll admin, error:%o message=Calling enrollment endpoint failed with error [Error: con
nect ECONNREFUSED 127.0.0.1:7054], stack=Error: Calling enrollment endpoint fail
ed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]
    at ClientRequest.request.on (C:\Users\Nibir Hira\go\src\github.com\hyperledg
er\fabric-samples\fabcar\javascript\node_modules\fabric-ca-client\lib\FabricCACl
ient.js:487:12)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Failed to enroll admin user "admin": Error: Calling enrollment endpoint failed w
ith error [Error: connect ECONNREFUSED 127.0.0.1:7054]

Where should I do corrections? The file registeradmin.js is not even working

Upvotes: 0

Views: 1638

Answers (3)

Hassan Risvy
Hassan Risvy

Reputation: 114

Here is a solution for Hyperledger Fabric v2.x. The problem is port no: 7054 is missing in test network.

In Linux (try if it works in virtual box), one way to solve is fresh restart from fabcar folder (not test network folder) then run again.

cd $HOME/fabric-samples/fabcar

./startFabric.sh javascript (by default it's goLang)

A fresh restart of the network will occur as "startFabric.sh" contains network up, down, chaincode installing, all in one. Now try again:

node enrollAdmin.js

Worked for me.

Extra: Now you can run node registerUser.js and node invoke.js if you were about to use invoke.js .

Upvotes: 2

TheGokhansimsek35
TheGokhansimsek35

Reputation: 11

I had the exact same problem. This worked for me:

  • Open VirtualBox Manager and select the “default” VM
  • Click “Settings”, “Network”, “Advanced”, “Port Forwarding”.
  • Create a new rule by clicking the “+” sign on the right and entering the following: Name -> “ca”, Host Port -> 7054, Guest Port -> 7054.
  • You can leave the Host IP and Guest IP unspecified.

Source: https://developer.ibm.com/opentech/2017/11/29/running-hyperledger-fabric-windows-revised/

Upvotes: 0

R Thatcher
R Thatcher

Reputation: 5570

Your node application cannot connect to the Fabric CA server running in the container - so either it is not running, has failed or possibly you have some firewall or other connectivity problem.

You can test connectivity by using wget or curl or a browser to hit this URL - http://localhost:7054/api/v1/cainfo and until you can hit this URL your enrollAdmin program will fail.

I don't use windows, but docker ps on Linux would tell me if the ca container was running, and docker logs ca.example.com would give me the log of the ca container (assuming you are running the fabcar sample on the basic sample network.)

Upvotes: 1

Related Questions