京东秒杀
国美-超级5
索尼Xperia旗舰
限时优惠页 - 京东
自营热卖

区块链实战问题及解决方案 原

白月光 1年前   阅读数 135 0

问题

1、Error: Cannot find module 'fabric-client'

解决:npm install

==========================================

2、Failed to query successfully :: Error: Failed to get user1.... run registerUser.js

解决:JiuChiDingPaMac:fabcar shijun$ node registerUser.js

新问题:Failed to register: Error: Failed to get admin.... run enrollAdmin.js

解决:步骤1:JiuChiDingPaMac:fabcar shijun$ node enrollAdmin.js

Store path:/Users/shijun/Desktop/openSourceProject/hyperledger/fabric-examples/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":"7200f4ddad2e0b7df90c315c8ce3810d6720ce67c41533f0b12e91cd03be984f","identity":{"certificate":"-----BEGIN CERTIFICATE-----\nMIICAjCCAaigAwIBAgIUfEl2J5DudnqmXsCrlnPUMkvoyrkwCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTgwNDMwMTQ0NDAwWhcNMTkwNDMwMTQ0\nOTAwWjAhMQ8wDQYDVQQLEwZjbGllbnQxDjAMBgNVBAMTBWFkbWluMFkwEwYHKoZI\nzj0CAQYIKoZIzj0DAQcDQgAEAZzYLggmT0AEnv0yfhHnEA1ZRLa29rAgyO+aUZeY\nYVRJo28NuPSVxP0PgqDVeRBpQWjQpwt8Fskhqz19U2RnoaNsMGowDgYDVR0PAQH/\nBAQDAgeAMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFPwJSeBRw4LM1iyRAmrKvtXu\nkQ2zMCsGA1UdIwQkMCKAIEI5qg3NdtruuLoM2nAYUdFFBNMarRst3dusalc2Xkl8\nMAoGCCqGSM49BAMCA0gAMEUCIQDkLDn5GnQxpSFtM+VHIubCxXUulZeCL9jaRNTW\n8vNMxQIgfEEuE1u+rKIXHgRcdMr6mwvoTO6OlQ3Jhl8lq0QGhmE=\n-----END CERTIFICATE-----\n"}}}

步骤2:JiuChiDingPaMac:fabcar shijun$ node registerUser.js

Store path:/Users/shijun/Desktop/openSourceProject/hyperledger/fabric-examples/fabric-samples/fabcar/hfc-key-store

Successfully loaded admin from persistence

Successfully registered user1 - secret:IWVvPoKavkLP

Successfully enrolled member user "user1" 

User1 was successfully registered and enrolled and is ready to intreact with the fabric network

步骤3:JiuChiDingPaMac:fabcar shijun$ node query.js

Store path:/Users/shijun/Desktop/openSourceProject/hyperledger/fabric-examples/fabric-samples/fabcar/hfc-key-store

Successfully loaded user1 from persistence

Query has completed, checking results

Response is  [{"Key":"CAR0", "Record":{"colour":"blue","make":"Toyota","model":"Prius","owner":"Tomoko"}},{"Key":"CAR1", "Record":{"colour":"red","make":"Ford","model":"Mustang","owner":"Brad"}},{"Key":"CAR2", "Record":{"colour":"green","make":"Hyundai","model":"Tucson","owner":"Jin Soo"}},{"Key":"CAR3", "Record":{"colour":"yellow","make":"Volkswagen","model":"Passat","owner":"Max"}},{"Key":"CAR4", "Record":{"colour":"black","make":"Tesla","model":"S","owner":"Adriana"}},{"Key":"CAR5", "Record":{"colour":"purple","make":"Peugeot","model":"205","owner":"Michel"}},{"Key":"CAR6", "Record":{"colour":"white","make":"Chery","model":"S22L","owner":"Aarav"}},{"Key":"CAR7", "Record":{"colour":"violet","make":"Fiat","model":"Punto","owner":"Pari"}},{"Key":"CAR8", "Record":{"colour":"indigo","make":"Tata","model":"Nano","owner":"Valeria"}},{"Key":"CAR9", "Record":{"colour":"brown","make":"Holden","model":"Barina","owner":"Shotaro"}}]

==========================================

3、Creating orderer.example.com ... error

ERROR: for orderer.example.com  Cannot create container for service orderer.example.com: b'Conflict. The container name "/orderer.example.com" is already in use by container "75c09c

解决:docker rm -f $(docker ps -aq)

==========================================

4、require('fabric-client'); ----Uncaught ReferenceError: require is not defined

解决:这是服务端的代码,不能运行在客户端

==========================================

5、$ node

> Web3 = require('web3')

Error: Cannot find module 'web3'

    at Function.Module._resolveFilename (module.js:547:15)

    at Function.Module._load (module.js:474:25)

    at Module.require (module.js:596:17)

    at require (internal/module.js:11:18)

解决:$ cd /Users/shijun/Desktop/truffleWorkspace/voteShiJun

$ npm install web3

==========================================

6、$ node

> solc = require('solc')

Error: Cannot find module 'solc'

    at Function.Module._resolveFilename (module.js:547:15)

    at Function.Module._load (module.js:474:25)

    at Module.require (module.js:596:17)

    at require (internal/module.js:11:18)

解决:$ cd /Users/shijun/Desktop/truffleWorkspace/voteShiJun

$ npm install solc 

==========================================

7、问题:

ERROR in ./app/javascripts/app.js

Module not found: Error: Can't resolve 'ipfs-api' in......

解决:

$ cd /Users/shijun/Desktop/truffleWorkspace/project

$ npm install --save ipfs-api


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: