首页 文章

启动Fabric Composer REST API服务器

提问于
浏览
2

我在完成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)

我该如何解决这个问题?

3 回答

  • -2

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

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

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

  • 0

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

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

    在该文件夹中,作曲家配置文件将在那里(如果你的默认配置文件是,那么将有一个名为defaultprofile的文件夹),检查defaultprofile文件夹中的connection.json .

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

  • 1

    您使用的是哪个版本的npm?我在ubuntu 16.4上遇到过类似的问题 . 当我用较低版本的npm重新安装evberything时,它工作得很好 .

    事情有效时的npm版本:

    npm --version
    3.10.10
    

    当我遇到问题时,你提到它是5.x

相关问题