如何在超级边缘Angular应用程序中启用身份验证

时间:2018-01-02 12:06:09

标签: angular blockchain hyperledger-fabric hyperledger hyperledger-composer

我已经通过以下this教程成功为多个组织部署了超级聚合器编辑器区块链。

我已使用命令yo hyperledger-composer:angular生成angular2应用程序,方法是选择使用现有网络的选项并生成新的rest api。

当我启动应用程序时,它是成功的,我可以使用URL http://localhost:4200

从hyperledgercomposer浏览资产和参与者

现在,我想通过以下this教程和angular2 app的编辑的package.json文件启用我已安装passport-github并配置了导出选项的其他身份验证,以便在启动时启用身份验证

 "app": "composer-rest-server --card admin@some-network -n never -p 3000 -m true"

我添加了-m true选项,以便在使用npm start命令启动angular2 app时默认启用身份验证。

当我开始申请时,我得到以下错误。如何解决这个问题?

[0] ** NG Live Development Server is running on http://localhost:4200 **
[0]  10% building modules 4/4 modules 0 activeDiscovered types from business network definition
[1] Generating schemas for all types in business network definition ...
[1] Generated schemas for all types in business network definition
[1] Adding schemas for all types to Loopback ...
[1] Added schemas for all types to Loopback
[1] { Error: Cannot find module 'passport-github'
[1]     at Function.Module._resolveFilename (module.js:536:15)
[1]     at Function.Module._load (module.js:466:25)
[1]     at Module.require (module.js:579:17)
[1]     at require (internal/module.js:11:18)
[1]     at PassportConfigurator.configureProvider (/home/user/tmt/TMT-Innovation-AngApp/node_modules/loopback-component-passport/lib/passport-configurator.js:158:22)
[1]     at Promise.then (/home/user/tmt/TMT-Innovation-AngApp/node_modules/composer-rest-server/server/server.js:133:38)
[1]     at <anonymous>
[1]     at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' }
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! TMT-Innovation-AngApp@0.0.1 app: `composer-rest-server --card admin@some-network -n never -p 3000 -m true`
[1] npm ERR! Exit status 1
[1] npm ERR! 

1 个答案:

答案 0 :(得分:0)

尝试npm install -g passport-github