简体   繁体   中英

Hyperledger Fabric Fabcar error for enrolladmin.js

I have started the fabric script and after that I run the enrolladmin.js file.

node enrolladmin.js

but got the following error. How to resolve it?

node enrollAdmin.js
fs.js:904
return binding.readdir(pathModule._makeLong(path), options.encoding);
             ^

Error: ENOENT: no such file or directory, scandir '/Users/jaspalsingh/fabric-samples/fabcar/node_modules/grpc/src/node/extension_binary'
    at Object.fs.readdirSync (fs.js:904:18)
    at Object.<anonymous> (/Users/jaspalsingh/fabric-samples/fabcar/node_modules/grpc/src/grpc_extension.js:37:23)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/jaspalsingh/fabric-samples/fabcar/node_modules/grpc/src/client.js:38:12)

I had the same problem. just resolved it by these steps:

  1. Create directory : < FABCAR_DIR>/node_modules/grpc/src/node/extension_binary/
  2. Do "npm install" in < FABCAR_DIR>
  3. Do "npm rebuild" in < FABCAR_DIR>

step 2 or 3 - one of them should solve the problem - try in the same order.

After step 2 OR step 3 - you should see a file. < FABCAR_DIR>/node_modules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc/grpc_node.node

After that enroll admin should succeed like:

sprint @ fabcar>node enrollAdmin.js
 Store path:/home/ravir/hl/fabric-samples/fabcar/hfc-key-store
Successfully enrolled admin user "admin"
Assigned the admin user to the fabric client ::{"name":"admin","mspid":"Org1MSP","roles":null,"affiliation":"","enrollmentSecret":"","enrollment":{"signingIdentity":"42d8536072cf7e47358c137b254d78d8e853934caee70d03dbec06a22f482ad9","identity":{"certificate":"-----BEGIN CERTIFICATE-----\}

if u look closely, the output of startFabric.sh prints

"

Start by installing required packages run 'npm install'
Then run 'node enrollAdmin.js', then 'node registerUser'

"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM