Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Errors #17

Open
smoore0509 opened this issue May 5, 2016 · 27 comments
Open

JS Errors #17

smoore0509 opened this issue May 5, 2016 · 27 comments
Assignees

Comments

@smoore0509
Copy link

I'm getting errors when the apachesolr-angularjs-search block loads on my pages.
To wit:

_app.js?o6q3hw:1 Uncaught TypeError: Cannot read property 'prototype' of undefined
vendor.js?o6q3hw:2 Error: [ng:areq] Argument 'mainController' is not a function, got undefined
_and finally
_vendor.js?o6q3hw:1 Uncaught Error: [$injector:unpr] Unknown provider: drupalDataServiceProvider <- drupalDataService
_
This looks to me as if the app isn't initializing properly in the first place.

Can anyone point me to the next step in debugging this?
TIA

@kporras07
Copy link
Contributor

Could you go inside the module and npm install && bower install; then comment out https://github.com/ManatiCR/apachesolr_angularjs_search/blob/7.x-1.x/gulpfile.js#L119 and run gulp build and then get a better error message? (You'll need gulp-cli installed globally) Please. This will enable us to get better understanding of what's happening.

@smoore0509
Copy link
Author

OK, I got this:

$ gulp build
(node:28036) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
module.js:440
throw err;
^

Error: Cannot find module 'jshint/src/cli'
at Function.Module._resolveFilename (module.js:438:15)
at Function.Module._load (module.js:386:25)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object. (/home/resonetrics/domains/cgshr.resonetrics.com/public_html/sites/all/modules/apachesolr_angularjs_search/node_modules/gulp-jshint/src/extract.js:1:79)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)

@kporras07
Copy link
Contributor

@smoore0509 what node version are you using? I just cloned the repo and npm install && bower install and then gulp build and it worked ok. (I'm using node v4.2.4)

@smoore0509
Copy link
Author

$ node -v
v6.0.0

@kporras07
Copy link
Contributor

I've never tested it with that node version; could you try using nvm and setting node versión to something in 4.x?

@smoore0509
Copy link
Author

OK, I've switched to 4.2.4, and am still getting the same error output on gulp build.
Should I smoke the whole module and re-install?

@kporras07
Copy link
Contributor

Could you remove node_modules and bower_components folders and then rerun npm install && bower install then gulp build?

@smoore0509
Copy link
Author

Well the gulp build seems to have worked fine, though the npm install popped out a couple of warnings:

npm WARN deprecated [email protected]: Please use gulp-clean-css
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN peerDependencies The peer dependency [email protected] included from gulp-jshint will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN optional dep failed, continuing [email protected]
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

Still experiencing the same errors in the console, sadly.

@kporras07
Copy link
Contributor

Yes; that's expected behavior; could you comment out the indicated line; rerun gulp build and after getting the same errors; paste the errors here? Please

@smoore0509
Copy link
Author

Just to be clear, we're talking about line 119 in gulpfile.js?
The one that reads

//.pipe($.uglify())

@kporras07
Copy link
Contributor

Yes; sure. It enables Drupal to use js file without minification.

@smoore0509
Copy link
Author

Gulp build seems to have run fine:

$ gulp build
[16:01:28] Using gulpfile ~/domains/cgshr.resonetrics.com/public_html/sites/all/modules/apachesolr_angularjs_search/gulpfile.js
[16:01:28] Starting 'clean:dist'...
[16:01:28] Finished 'clean:dist' after 112 ms
[16:01:28] Starting 'build'...
[16:01:28] Starting 'html'...
[16:01:28] Starting 'styles'...
[16:01:30] Finished 'build' after 1.83 s
[16:01:30] Finished 'html' after 2.03 s
[16:01:30] Finished 'styles' after 1.54 s
[16:01:30] Starting 'client:build'...
[16:01:33] Finished 'client:build' after 3.43 s

Here's what I'm seeing in the console on the page load:

Uncaught TypeError: Cannot read property 'prototype' of undefined
vendor.js?o6rubn:13550

Error: [ng:areq] Argument 'mainController' is not a function, got undefined
http://errors.angularjs.org/1.5.5/ng/areq?p0=mainController&p1=not%20a%20function%2C%20got%20undefined
at vendor.js?o6rubn:68
at assertArg (vendor.js?o6rubn:1880)
at assertArgFn (vendor.js?o6rubn:1890)
at $controller (vendor.js?o6rubn:10091)
at setupControllers (vendor.js?o6rubn:9209)
at nodeLinkFn (vendor.js?o6rubn:9002)
at compositeLinkFn (vendor.js?o6rubn:8397)
at compositeLinkFn (vendor.js?o6rubn:8400)
at publicLinkFn (vendor.js?o6rubn:8277)
at vendor.js?o6rubn:1751(anonymous function) @ vendor.js?o6rubn:13550
vendor.js?o6rubn:4616

Uncaught Error: [$injector:unpr] Unknown provider: drupalDataServiceProvider <- drupalDataService
http://errors.angularjs.org/1.5.5/$injector/unpr?p0=drupalDataServiceProvider%20%3C-%20drupalDataService

@kporras07
Copy link
Contributor

@smoore0509 sorry for delay in response. Still having issues?

Could you ensure that equivalent to this (https://github.com/ManatiCR/apachesolr_angularjs_search/blob/7.x-1.x/src/app/app.module.js#L33) and this (https://github.com/ManatiCR/apachesolr_angularjs_search/blob/7.x-1.x/src/app/main/main.controller.js#L12) in dist/app/app.js is getting executed? (maybe placing console.log or similar)

@smoore0509
Copy link
Author

smoore0509 commented May 10, 2016

Thanks for staying with this.

I've stuck in some console.log() calls both before and after the lines you mentioned, and none of them are getting executed.
For example:

    console.log("Before main = this");
var main = this;
    console.log("After main = this");

and

    console.log("Before mainControllerElement assign");
      var mainControllerElement = angular.element(document.getElementById('advanced-search-controller'));
    console.log("After mainControllerElement assign");

The console.log calls aren't happening.

Still getting all this in the console:

app.js?o6z5pi:104 Uncaught TypeError: Cannot read property 'prototype' of undefined
(anonymous function) @ app.js?o6z5pi:104
(anonymous function) @ app.js?o6z5pi:123
vendor.js?o6z5pi:13550 Error: [ng:areq] Argument 'mainController' is not a function, got undefined
http://errors.angularjs.org/1.5.5/ng/areq?p0=mainController&p1=not%20a%20function%2C%20got%20undefined
at vendor.js?o6z5pi:68
at assertArg (vendor.js?o6z5pi:1880)
at assertArgFn (vendor.js?o6z5pi:1890)
at $controller (vendor.js?o6z5pi:10091)
at setupControllers (vendor.js?o6z5pi:9209)
at nodeLinkFn (vendor.js?o6z5pi:9002)
at compositeLinkFn (vendor.js?o6z5pi:8397)
at compositeLinkFn (vendor.js?o6z5pi:8400)
at publicLinkFn (vendor.js?o6z5pi:8277)
at vendor.js?o6z5pi:1751(anonymous function)
@ vendor.js?o6z5pi:13550(anonymous function)
@ vendor.js?o6z5pi:10225Scope.$apply @ vendor.js?o6z5pi:17334bootstrapApply @ vendor.js?o6z5pi:1749invoke @ vendor.js?o6z5pi:4665doBootstrap @ vendor.js?o6z5pi:1747bootstrap @ vendor.js?o6z5pi:1767angularInit @ vendor.js?o6z5pi:1652(anonymous function) @ vendor.js?o6z5pi:30863trigger @ vendor.js?o6z5pi:3166defaultHandlerWrapper @ vendor.js?o6z5pi:3456eventHandler @ vendor.js?o6z5pi:3444
vendor.js?o6z5pi:68 Uncaught Error: [$injector:unpr] Unknown provider: drupalDataServiceProvider <- drupalDataService
http://errors.angularjs.org/1.5.5/$injector/unpr?p0=drupalDataServiceProvider%20%3C-%20drupalDataService

@kporras07
Copy link
Contributor

Hi there,
Sorry for the big delay; I've had a lot of stuff to do during these days.

Assuming you're not using IE (it's supposed to work on IE < 9, but I didn't fully tested it); could you outline the steps you followed to try to get this working, so that I could try to setup an environment and reproduce the error?

Drupal flavor (vanilla or distro), some important enabled modules that could potentially create a conflict, jquery update (and version if it's in use), etc.

I really hope this could help me to reproduce the error and try to help you

@smoore0509
Copy link
Author

Hi Kevin - thanks for getting back to me.
This is happening in Chrome (though I will need to support IE at some point).
We're using Drupal 7.43, standard install, php 5.6.5, and jQuery 1.4.4 (the one that comes with Drupal). If I switch to other versions ofjQuery up to 2.1, I get different errors.
I've attached a list of modules enabled.
CGSHR_enabled_list.txt

A sample search is here:
http://cgshr.resonetrics.com/apachesolr-angularjs-search/war

Please let me know what else I can tell you.

@kporras07
Copy link
Contributor

kporras07 commented May 24, 2016

Hey, that's weird; It looks like you haven't configured the advanced search block (there are no available fields to search); could you try configuring the advanced search block and place it in a different path than the results page? Then try to use it.

@smoore0509
Copy link
Author

Actually I did - and I had a lot of trouble with the draggable interface, getting the target columns to show up properly, but I did eventually get it started.
Screen shot attached.
This block is visible on several pages, including http://cgshr.resonetrics.com/angular

_apachesolr_angularjs_advanced_search__block___the_consortium_on_gender__security_and_human_rights

@kporras07
Copy link
Contributor

Yes, that config GUI is not so great :/ Actually for some stuff maybe you will need to do some custom code. I'm getting access denied to the provided link.

@smoore0509
Copy link
Author

smoore0509 commented May 24, 2016

Sorry, forgot to publish that node - you should be able to get to it now

On May 24, 2016, at 4:58 PM, Kevin Porras [email protected] wrote:

Yes, that config GUI is not so great :/ Actually for some stuff maybe you will need to do some custom code. I'm getting access denied to the provided link.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #17 (comment)

@kporras07
Copy link
Contributor

@smoore0509 hey, I think I found the issue; could you pull the latest version of this GH repo? I also fixed 2 other bugs.

@smoore0509
Copy link
Author

Well I'm getting a different error... perhaps that's progress :-)
http://cgshr.resonetrics.com/angular

jquery-1.5.2.js:3642 Uncaught Syntax error, unrecognized expression: [href=/angular]

I noticed you made a change to the .install file - do I need to uninstall and re-install?

@kporras07
Copy link
Contributor

Where did you get that error? It looks like it's working now

@smoore0509
Copy link
Author

It looks like it's working now

Only if you're not logged in!
???
it does look rather good for anonymous user - will mess with it some more.

@smoore0509
Copy link
Author

OK I've determined that there's definitely a conflict with the contrib Admin module (https://www.drupal.org/project/admin) that prevents the Advanced search fields from initiating, and seems to be responsible for the failure of the app to start.
Note that the contrib Admin Menu (https://www.drupal.org/project/admin_menu) and its children create no conflict, and are safe to use, as far as I can tell.

@kporras07
Copy link
Contributor

Those are great news!
I've never used admin, but I totally can take a look :)

Thanks,

On Sun, Jun 5, 2016, 14:27 Sam Moore [email protected] wrote:

OK I've determined that there's definitely a conflict with the contrib
Admin module (https://www.drupal.org/project/admin) that prevents the
Advanced search fields from initiating, and seems to be responsible for the
failure of the app to start.
Note that the contrib Admin Menu (
https://www.drupal.org/project/admin_menu) and its children create no
conflict, and are safe to use, as far as I can tell.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ACHXXFv7fD2veSDkr3VvWfZNYkAywqnkks5qIzEvgaJpZM4IYd9X
.

@smoore0509
Copy link
Author

Thanks for staying with this. Overall this module is helping me a lot, so it's very gratifying to be able to get it working.
I'm ditching the Admin module, as Search is more important, and Admin Menu is fine.

@kporras07 kporras07 self-assigned this Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants