Error: Cannot find module 'fabric-client/lib/EventHub.js' 部署fabric-explorer时

~/go/src/github.com/hyperledger/fabric-explorer# ./start.sh 
module.js:550
    throw err;
    ^

Error: Cannot find module 'fabric-client/lib/EventHub.js'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/root/go/src/github.com/hyperledger/fabric-explorer/service/fabricservice.js:7:16)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

这是因为在fabric1.2.0以后已经不在支持EventHub.js了, 需要用ChannelEventHub 来代替 , 但是我肯定不能改它的源码 . 只需要把依赖换成1.0.5就可以了 , 

1 把下载好的fabric-client和fabric-ca-client从node_modules里面删除, (注意路径的对照哦,我当前是在浏览器的根目录,)

rm -rf ./node_modules/fabric-ca-client/
rm -rf ./node_modules/fabric-client/

2下载1.0.5的fabric-client和fabric-ca-client

npm install [email protected]
npm install [email protected]

再次启动 , ./start.sh 问题解决

猜你喜欢

转载自blog.csdn.net/qq_27348837/article/details/87362268