首页 > 解决方案 > 区块链浏览器:错误:找不到模块

问题描述

执行以下命令时出现错误:

命令:

node main.js

错误:

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> (/home/murugesan/Blockchain/fabric-explorer/app/query.js:21: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)

标签: hyperledger-fabrichyperledger

解决方案


如果您已从先前版本的 Fabric 升级到 1.3,则 EventHub.js 不再存在。您必须更改代码以改用 ChannelEventHub。有关详细信息,请参阅如何使用基于通道的事件服务

如果您仍在使用 fabric 1.2 或更早版本,则可能安装了错误的客户端版本。要安装正确的版本,请运行

npm install fabric-ca-client@fabricVersion

例如

npm install fabric-ca-client@1.2.1

推荐阅读