启动 Fabric Composer REST API 服务器

Start up Fabric Composer REST API server

我在完成 Fabric Composer 快速入门后尝试使用 composer-rest-server 包,但我失败了。

请指教

已成功安装 composer-rest-server 包。

npm install -g composer-rest-server

Composer-rest-server 已启动。

composer-rest-server

我被要求输入有关业务网络的简单信息。 之后,我无法加载连接器模块'composer-connector-hlf'。

? Enter your Fabric Connection Profile Name: defaultProfile 
? Enter your Business Network Identifier : digitalproperty-network
? Enter your Fabric username : WebAppAdmin
? Enter your secret: DJY27pEnl16d
? Specify if you want namespaces in the generated REST API: always use namespace
s
? Specify if you want the generated REST API to be secured: Yes

To restart the REST server using the same options, issue the following command:
   composer-rest-server -p defaultProfile -n digitalproperty-network -i WebAppAdmin -s DJY27pEnl16d -N always -S true

Discovering types from business network definition ...
Connection fails: Error: Failed to load connector module "composer-connector-hlf" for connection profile "defaultProfile"
It will be retried for the next request.
Error: Failed to load connector module "composer-connector-hlf" for connection profile "defaultProfile"
    at connectionProfileStore.load.then.e (/home/user1/.nvm/versions/node/v6.9.5/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/connectionprofilemanager.js:148:27)

我该如何解决这个问题?

你的grpc模块有grpc_node.node个文件吗? 它在 composer-cli 模块中。

在我的环境中 /usr/local/lib/node_modules/composer-cli/node_modules/grpc/src/node/extension_binary/grpc_node.节点

如果你使用 sudo,你可能需要添加 --unsafe-perm 选项。
比如:sudo npm install -g --unsafe-perm composer-cli

您的 .composer-connection-profiles 未设置为 defaultprofile。

检查您的根文件夹,必须存在 .composer-connection-profiles 文件夹。

在该文件夹中将有作曲家配置文件(如果创建了 defaultprofile,则会有一个名为 defaultprofile 的文件夹),检查 defaultprofile 文件夹中的 connection.json。

如果有任何其他名称不同的文件夹,请将其用作您的配置文件。或者您可以专门定义文件夹 defaultprofile 并写入 connection.json 和连接详细信息。

您使用的是哪个版本的 npm?我在 ubuntu 16.4 上遇到了类似的问题。当我使用较低版本的 npm 重新安装 evberything 时,它运行良好。

运行时的 npm 版本:

npm --version
3.10.10

当我遇到你提到的问题时 5.x