Dhananjay Dhananjay - 13 days ago 6
AngularJS Question

Module 'algoliasearch' is not available Error

I am trying to create a Instant Search Prototype using Algolia AngularJS module . I am using an app generated via jhipster (Micro Service Gateway) which uses Angular JS v1.x.

However when I launch my app I get this error:
enter image description here

I ran the following commands to install algolia search js module

1. npm install algoliasearch --save
2. bower install algoliasearch -S
3. Added algoliasearch as a dependency in app.module.js


I also cross checked all relevant files (See Below) but couldnt find any problems. Other modules are loaded properly.


  1. index.html : This has script tag for algoliasearch.js file which is present locally:
    enter image description here

  2. bower.json has algoliasearch js client installed properly and I can see algoliasearch folder under bower_components
    enter image description here

  3. Here is where I have added algoliasearch js module app.module.js
    enter image description here



Not sure if I have missed anything. Any help on resolving this issue would be great.

Update 11/20:
Thanks to the Answers here. I got this working by adding the following to my bower.json file

"algoliasearch": {
"main":[
"dist/algoliasearch.js",
"dist/algoliasearch.angular.js"
],
"dependencies": {
"angular": "1.5.8"
}
},

Answer

Specific to JHipster: to get algoliasearch.angular.js automatically included you need to add it to your project's bower.json file like what we already do for other dependencies when their bower.json does not include enough files (too many) required in our context:

"overrides": {
    "algoliasearch ": {
      "main": [
        "dist/algoliasearch.js",
        "dist/algoliasearch.angular.js"
      ]
    },

No need to include minified versions of these files as they'll get minified by JHipster gulp build process.

Comments