hyperledger-fabric - 区块链浏览器:错误:找不到模块
问题描述
执行以下命令时出现错误:
命令:
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)
解决方案
如果您已从先前版本的 Fabric 升级到 1.3,则 EventHub.js 不再存在。您必须更改代码以改用 ChannelEventHub。有关详细信息,请参阅如何使用基于通道的事件服务。
如果您仍在使用 fabric 1.2 或更早版本,则可能安装了错误的客户端版本。要安装正确的版本,请运行
npm install fabric-ca-client@fabricVersion
例如
npm install fabric-ca-client@1.2.1
推荐阅读
- javascript - 如何在 webdriverIO 中突出显示 WebElement?
- redis - Redis 中的单独列表
- javascript - 在现有元素旁边放置一个新元素
- javascript - 快速响应空无键
- c# - UWP:开始菜单磁贴文本颜色
- swift - 语音识别开始并立即失败,出现 kAFAssistantErrorDomain 错误 7
- r - 总结百分比计算无效的“类型”错误
- python - 使用令牌认证和 functools.wraps 构建装饰器
- typescript - 从匿名泛型函数的预期参数中提取类型
- android - 无法解析类 android.support.constraint.ConstraintLayout