启动composer-rest-server

时间:2017-10-12 21:35:34

标签: ibm-cloud blockchain hyperledger-fabric hyperledger hyperledger-composer

我正在撰写本教程https://hyperledger.github.io/composer/tutorials/developer-guide.html

在我要通过运行命令

启动composer-rest-server时生成REST API部分
composer-rest-server

我收到以下错误:

/home/../.nvm/versions/node/v6.11.4/lib/node_modules/composer-rest-server/node_modules/lodash-compat/internal/LodashWrapper.js:1
(function (exports, require, module, __filename, __dirname) { pf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode)

SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/../.nvm/versions/node/v6.11.4/lib/node_modules/composer-rest-server/node_modules/lodash-compat/chain/lodash.js:2:21)

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

尝试使用以下方法全局安装软件包:

npm install -g composer-rest-server

答案 1 :(得分:0)

首先卸载composer rest服务器

npm uninstall composer-rest-server

第二次安装

npm install -g composer-rest-server@0.20.5 

版本根据您的要求,然后在运行composer-rest-server之后会询问一些问题 如下。提供详细信息

composer-rest-server
? Enter the name of the business network card to use: admin@your-network-Name
? Specify if you want namespaces in the generated REST API: never use namespaces
? Specify if you want to use an API key to secure the REST API: No
? Specify if you want to enable authentication for the REST API using Passport: No
? Specify if you want to enable the explorer test interface: No
? Specify a key if you want to enable dynamic logging: No
? Specify if you want to enable event publication over WebSockets: Yes
? Specify if you want to enable TLS security for the REST API: No