Requirejs with Elasticsearch Angular app throwing "lib/connectors/angular" has not been loaded yet for context: _. Use require([])


(Nithyanand) #1

I am trying to build Elasticsearch Angular app. I am using require.js.

main.js

require.config({

paths : {
'angular' : '../bower_components/angular/angular',
'elasticsearch' : '../node_modules/elasticsearch/src/elasticsearch.angular',
'app' : 'app',
'coreModule':'coreModule',
'esClient' : 'service/esClient'
},

shim : {

'app':{
'deps' : ['angular','coreModule']
},

'coreModule' : {
'deps' :['angular', 'elasticsearch','esClient']
},

'esClient' : {
'deps' :['angular', 'elasticsearch']
}

}

});

require(['app'], function(){

angular.bootstrap(document, ['app']);
});

esClient.js

define(function(){

var esClient=angular.module('esClient', ['elasticsearch']);

esClient.service('client', function (esFactory) {
return esFactory({
host: 'http://localhost:9200',
apiVersion: '1.5',
log: 'trace'
});
});

});


But it is throwing the following errors. Anyone else faced this issue?

Uncaught Error: Module name "lib/connectors/angular" has not been loaded
yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded
makeError @ require.js:166
localRequire @ require.js:1407
requirejs @ require.js:1752
(anonymous function) @ elasticsearch.angular.js:7
coreModule.js:3 coreModule module
app.js:4 App module
angular.js:63 Uncaught Error: [$injector:modulerr] Failed to instantiate
module app due to:
Error: [$injector:modulerr] Failed to instantiate module coreModule due to:
Error: [$injector:modulerr] Failed to instantiate module esClient due to:
Error: [$injector:modulerr] Failed to instantiate module elasticsearch due
to:
Error: [$injector:nomod] Module 'elasticsearch' is not available! You
either misspelled the module name or forgot to load it. If registering a
module ensure that you specify the dependencies as the second argument.

PS : I previous used bower installed elasticsearch. Now using npm install.
Hence the updated comment.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7446c914-3e4c-4183-8399-cc72d436b8b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2