Unable to dynamically load npm-modules in ionic

元气小坏坏 提交于 2019-12-10 12:15:19

问题


I am running into an issue using the combination of the hyberledger-composer-common npm module and ionic. Basic setting up works as expected but when i am trying to connect to the hyperledger network it throws the following error:

Error: Failed to load connector module "composer-connector-hlfv1" for connection profile "Default". curmod.require is not a function-connectionManagerLoader.require is not a function-connectionManagerLoader.require is not a function-Cannot find module "."
    at connectionProfileStore.load.then (connectionprofilemanager.js:160)
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (core.es5.js:3890)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.es5.js:3881)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)

I am fairy new to using ionic and javascript builders so i have no clue where to look. I am guessing it has something to do with polyfills and the way ionic handles paths but i am not sure. Could anyone give me a bump in the right direction?

The application also throws a similar error while trying to instantiate the loggerclass:

Failed to load logger module ./winstonInjector.js: Cannot find module "."

The implementation is as follows:

//example
var loggerToUse = './winstonInjector.js';
myLogger = require(loggerToUse);

Which gave me the idea the issue is regarding dynamically loading modules :)

来源:https://stackoverflow.com/questions/46666884/unable-to-dynamically-load-npm-modules-in-ionic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!