【问题标题】:Error launching composer-rest-server启动 composer-rest-server 时出错
【发布时间】:2017-10-12 21:35:34
【问题描述】:

我正在编写本教程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)

我该如何解决这个问题?

【问题讨论】:

  • 您的操作系统和版本是什么 - 您使用的是 Windows 吗?你的码头工人版本是什么?这是本地作曲家 REST 服务器实例吗?用于启动作曲家休息服务器的命令是什么?您是否设法创建了本地 .bna 文件(以便生成您的贸易网络​​?)?
  • 两个问题:第一:你是否在项目文件夹中 npm 安装并部署在 dist 文件夹中?第二:你能在括号中使用这个命令 ping 吗(composer network ping -n my-network - p hlfv1 -i admin -s adminpw)?如果您在两个步骤中都获得命令成功,请尝试使用 ./startFabric.sh 启动结构实例,然后在 fabric-tools 文件夹中使用 ./createFabric.sh。

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


【解决方案1】:

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

npm install -g composer-rest-server

【讨论】:

    【解决方案2】:

    先卸载composer rest server

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-26
      • 1970-01-01
      • 2018-05-25
      • 1970-01-01
      • 1970-01-01
      • 2015-12-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多