Hyperledger Explorer安装失败

时间:2018-04-12 11:15:56

标签: node.js ubuntu npm hyperledger-fabric hyperledger

我一直在尝试将Hyperledger Explorer安装到Hyperledger Fabric(1.0)的AWS实例上。我指的是https://github.com/hyperledger/blockchain-explorer中提到的安装步骤,这些步骤也在下面提到。

cd blockchain-explorer/app/test

npm install

npm run test

cd blockchain-explorer

npm install

cd client/

npm install

npm test -- -u --coverage

npm run build

命令npm run test失败,出现以下错误。任何提示?

ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-exp                                                                                                                     lorer$ npm run test

> hyperledger-explorer@0.3.0 test /home/ubuntu/gopath/src/github.com/hyperledger                                                                                                                     /fabric/blockchain-explorer
> echo 'Error: no test specified'

Error: no test specified
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-exp                                                                                                                     lorer$ cd ..
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric$ cd examples/e                                                                                                                     2e_cli/
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/examples/e2e_c                                                                                                                     li$ npm run test
npm ERR! path /home/ubuntu/gopath/src/github.com/hyperledger/fabric/examples/e2e                                                                                                                     _cli/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/ubuntu/gopath/src                                                                                                                     /github.com/hyperledger/fabric/examples/e2e_cli/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2018-04-12T11_02_45_161Z-debug.log
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/examples/e2e_cli$ cd ..                                                                                                            ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/examples$ cd ..
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric$ cd blockchain-explorer/
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer$ cd app/test/
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$ npm install
npm WARN hyperledger-explorer-test@0.3.0 No repository field.

up to date in 1.802s
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$ sudo npm install
npm WARN hyperledger-explorer-test@0.3.0 No repository field.

up to date in 1.725s
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$ ls -all
total 104
drwxrwxr-x  3 ubuntu ubuntu  4096 Apr 12 10:39 .
drwxrwxr-x 11 ubuntu ubuntu  4096 Apr 12 10:11 ..
drwxrwxr-x 61 ubuntu ubuntu  4096 Apr 12 10:39 node_modules
-rw-rw-r--  1 ubuntu ubuntu   433 Apr 12 10:39 package.json
-rw-rw-r--  1 ubuntu ubuntu 83488 Apr 12 10:39 package-lock.json
-rw-rw-r--  1 ubuntu ubuntu   519 Apr 12 10:11 test.js
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$ vi package.json
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$ vi package.json
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$ clear
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$ npm run test

> hyperledger-explorer-test@0.3.0 test /home/ubuntu/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test
> mocha *.js  --exit

module.js:549
    throw err;
    ^

Error: Cannot find module 'log4js'
    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)
    at Object.<anonymous> (/home/ubuntu/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/helper.js:17:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/ubuntu/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test/test.js:7:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /home/ubuntu/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/home/ubuntu/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/home/ubuntu/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test/node_modules/mocha/lib/mocha.js:536:10)
    at Object.<anonymous> (/home/ubuntu/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test/node_modules/mocha/bin/_mocha:582:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hyperledger-explorer-test@0.3.0 test: `mocha *.js  --exit`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hyperledger-explorer-test@0.3.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2018-04-12T11_08_28_132Z-debug.log
ubuntu@ip-172-31-2-180:~/gopath/src/github.com/hyperledger/fabric/blockchain-explorer/app/test$

2 个答案:

答案 0 :(得分:5)

我遇到同样的错误,你需要先在命令下运行 check image

cd blockchain-explorer
npm install

cd blockchain-explorer/app/test
npm install
npm run test

答案 1 :(得分:0)

尝试使用sudo运行所有命令。

cd blockchain-explorer/app/test

sudo npm install

npm run test

cd blockchain-explorer

sudo npm install

cd client/

npm install

npm test -- -u --coverage

npm run build

请忽略上述命令运行期间将收到的所有错误和警告。

当您运行“ npm run build”时,应同时从单独窗口中的区块链资源管理器文件夹中启动./start.sh,以便您可以查看所有日志。