启动Hyperledger Explorer失败:出现EISDIR目录读取错误
解决Hyperledger Explorer启动时的EISDIR读取目录错误
你遇到的启动错误日志如下:
postgres://hppoc:password@127.0.0.1/fabricexplorer fs.js:675 return binding.read(fd, buffer, offset, length, position); ^ Error: EISDIR: illegal operation on a directory, read at Object.fs.readSync (fs.js:675:18) at tryReadSync (fs.js:540:20) at Object.fs.readFileSync (fs.js:583:19) at configuration.getPeersByOrg.forEach.key (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:164:20) at Array.forEach (<anonymous>) at FabricClientProxy.setupPeers (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:161:36) at configuration.getOrgs.forEach.key (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:155:10) at Array.forEach (<anonymous>) at FabricClientProxy.createDefault (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:137:27) at new FabricClientProxy (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:32:8)
嘿,我帮你拆解下这个问题——日志里的EISDIR: illegal operation on a directory, read是核心线索,这说明Hyperledger Explorer在尝试读取某个文件时,实际指向的是一个目录,导致读取操作直接失败。具体报错在FabricClientProxy.js:164,也就是程序遍历组织节点配置、读取证书/密钥文件的时候出了问题。
一步步排查修复:
检查
config.json里的证书/密钥路径
找到Explorer的配置文件(一般在blockchain-explorer/app/config.json),重点盯紧organizations下每个组织的adminPrivateKey、signedCert,还有peers节点的tlsCACerts这些配置项:- 一定要保证这些路径指向具体的文件,而不是目录。举个例子,你的Admin私钥肯定在
keystore目录下,但不能直接把这个目录路径写进去,得指定到那个_sk结尾的具体密钥文件。 - 错误示范:
"adminPrivateKey": { "path": "/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore" } - 正确写法:
"adminPrivateKey": { "path": "/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/7a9b8c7d6e5f4a3b2c1d0e9f8g7h6i5j_sk" }
- 一定要保证这些路径指向具体的文件,而不是目录。举个例子,你的Admin私钥肯定在
验证路径的有效性
用命令行确认配置里的路径是不是真的文件:ls -l /你配置的路径如果输出开头是
d(代表目录),那肯定是路径写错了,赶紧改成具体的文件名。重启Explorer服务
改完配置后,先停掉当前的Explorer进程,再重新启动:cd /home/ubuntu/blockchain-explorer ./stop.sh ./start.sh
另外提醒下,尽量用绝对路径来配置,避免相对路径因为Explorer启动的工作目录不同而解析出错,绝对路径更稳妥。
内容的提问来源于stack exchange,提问作者Chandan Chanda
相关产品推荐
相关产品推荐

