I'm porting some core angular stuff to a new project. Now I get injector errors but the stacktrace / angular error page does not show the classname of the offending injection errors. All I get is
Error: $injector:modulerr
Module Error
Usually there is a class name in there somewhere. Now I have to go through every single class (of dozens and dozens) and check the imports manually. Isn't there a better way? I've seen this happening while just adding classes. Sometimes it will show the name of the missing injection, sometimes it just comes up blank, when otherwise the stacktrace correctly identifies the missing/bad injection.
Is there some extra debug mode I can get at this information with?
The full (unuseful) stacktrace:
Failed to instantiate module FSApp due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.2.16/$injector/modulerr?p0=FSApp&p1=Error…cape%2Fmain%2Fresources%2Flib%2Fangular-1.2.16%2Fangular.min.js%3A32%3A445)
at Error (native)
at http://fs/main/resources/lib/angular-1.2.16/angular.min.js:6:450
at http://fs/main/resources/lib/angular-1.2.16/angular.min.js:33:332
at Array.forEach (native)
at q (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:7:280)
at e (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:32:445)
at http://fs/main/resources/lib/angular-1.2.16/angular.min.js:33:18
at Array.forEach (native)
at q (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:7:280)
at e (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:32:445
If you want to try to reproduce this, commit your changes. Delete a couple files here and there. Run your angular app. IF you delete enough you will soon get blank injector errors.
A few tips and tricks:
A similar injector error answer applies here: set a break point on the angular error code and look at the call stack.
Also, occasionally click the link at the top of the stack trace takes to a page (without the class name), but where the page's error has another stack trace link. Click on that link and the second page may have the name of the missing object.
Also, if you haven't moved to annotated code (which can make it easier to spot injector errors)In angular 1.3 and greater, you can use the directive 'ng=strict-di' on whatever element has the ng-app directive, and that will cause the app to throw an error on any un-annotated module--and it will include the function along with the parameters ('function($scope, service, something)') which is hopefully unique enough to find quickly.
Related
Module not found: Error: Can't resolve './components/AppFooter' in 'C:\Users\TITAS\Desktop\Present Connection\projektas\react-ui-crud\src'
Sorry for weird question.
To begin with, I deleted AppHeader.js class (the top part of project's website). No problem arised with that. After that, I deleted AppFooter.js too (bottom part) and now it shows me this error. It seems like some part of my code still searches for AppFooter class but I can't find out.
Not sure if this is the appropriate place for this question, but when I simply updated my Angular script from 1.4.8 to 1.5.11, the UI bombs out and throws an error when attempting to do an angular.bootstrap(...):
https://code.angularjs.org/1.5.11/docs/error/$injector/modulerr?p0=ckwy4037000003e8twhn1wp0a&p1=Error: [$injector:modulerr] http://errors.angularjs.org/1.5.11/$injector/modulerr?p0=sn.common.attachments&p1=Error: [$injector:nomod] http://errors.angularjs.org/1.5.11/$injector/nomod?p0=sn.common.attachments
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:9:426
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:28:235
at b (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:27:282)
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:28:20
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:43:17
at q (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:10:371)
at g (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:42:382)
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:43:34
at q (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:10:371)
at g (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:42:382)
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:9:426
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:43:292
at q (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:10:371)
at g (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:42:382)
at http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:43:34
at q (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:10:371)
at g (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:42:382)
at fb (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:46:381)
at c (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:24:19)
at Object.Gc [as bootstrap] (http://localhost:8080/scripts/angular_includes_1.5.11.jsx?v=Wed_Dec_08_12_09_54_PST_2021:24:332
...wondering if anyone else has come across this issue, and if they have an idea of what's going on?
I'm not really familiar with Angular, but from looking at the docs, when I compare between v1.4.8 and v1.5.11, the only difference I see is the two yellow banners - one in particular that says:
Note: Do not bootstrap the app on an element with a directive that
uses transclusion, such as ngIf, ngInclude and ngView. Doing this
misplaces the app $rootElement and the app's injector, causing
animations to stop working and making the injector inaccessible from
outside the app.
This looks related, but I'm not 100% certain that that may be...
Fixed in the comments:
Are you still providing sn.common.attachments, per your error URL?
you were right! It was a bad path (changed the version number in the path, but that path doesn't exist for that version)... Thank you!!!!
Angular employs a technique where its error messages are encoded as URLs, which enables more-informative and translatable error messages without bloating the production app size. Consequently, that first https://code.angularjs.org/ URL actually contains the real $injector:nomod error that the URL target describes. From there it's easier to see that the bootstrap failed due to the absence of a module, here sn.common.attachments specifically.
The XXX are just names that I need to keep confidential.
Compiling module com.XXX.XXX.XXX_Test
Validating newly compiled units
Ignored 12 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Scanning for additional dependencies: file:/D:/Eclipse/Indigo/Workspace/XXX%20Test/src/com/XXX/XXX/client/Restlet.java
Computing all possible rebind results for 'com.wai.XXX.client.proxy.DonglesProxy'
Rebinding com.XXX.XXX.client.proxy.DonglesProxy
Checking rule <generate-with class='org.restlet.rebind.ClientProxyGenerator'/>
[ERROR] Errors in 'file:/D:/Eclipse/Indigo/Workspace/XXX%20Test/src/com/XXX/XXX/client/proxy/DonglesProxy.java'
[ERROR] Line 11: No source code is available for type org.restlet.resource.ClientProxy; did you forget to inherit a required module?
[ERROR] Unable to find type 'com.XXX.XXX.client.proxy.DonglesProxy'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
Here is what the console tells me when I try to do a GWT Compile on my project. What I don't understand that I've included the 'org.restlet.jar' into the buildpath of the project and have the following imports in the DonglesProxy source code:
import org.restlet.resource.ClientProxy;
import org.restlet.resource.Put;
Anyone any ideas?
I'm new to Java and the whole Web Application process so my knowledge is a bit lacking. This is actually someone else's project that has been left unfinished so I'm trying to debug/understand someone else code whilst learning as I go along...nightmare :(
Any help would be greatly appreciated!
Cheers
Kev
You must use :
import org.restlet.client.resource.ClientProxy;
import org.restlet.client.resource.Get;
import org.restlet.client.resource.Post;
import org.restlet.client.resource.Result;
to define the proxies; Take notice of the "client" part;
The referenced imports must be part of the GWT distribution;
You have to add it to your projects xml file. That is to com.XXX.XXX.XXX_Test.gwt.xml or something like that.
You have to add this line there,
<inherits name='org.restlet.whateverClass.xmlfilename />'
This means you are pointing to the xml file named xmlfilename.xml at the path org.restlet.whteverclass
So say for example if i am using sencha ui libraries jar, I will add,
<inherits name='com.sencha.gxt.ui.GXT' />
So here there will should be a xml file called GXT.xml at the path 'com.sencha.gxt.ui'
I'm getting an error with an SDK2.0 app using a rally custom grid:
It only errors with IE (current), and it does not error if I run it locally, only when I install it in Rally and run it.
I don't know if its a Rally issue, or a EXTJS issue.
SCRIPT5007: Unable to get value of the property 'modelField': object is null or undefined
sdk.js, line 4 character 1276692
The code that failed:
if(e.modelField&&e.modelField.hidden)
Context around that error:
{xtype:"rallytextfield",allowBlank:false,removeNameAttribute:true}}},PortfolioItem:function(){return{hidden:true}},AttributeType:function(b){return a.apply(Rally.ui.grid.FieldColumnFactory.defaultRenderer(b),{sortable:false})}})})();(function(){var a=window.Ext4||window.Ext;var b=function(g,e){var d=g.text;var c=e.text;if(d>c){return 1}if(d<c){return -1}return 0};a.define("Rally.ui.grid.ColumnBuilder",{requires:["Ext.Array","Ext.util.Format","Rally.ui.grid.FieldColumnFactory"],constructor:function(){this.defaultColumns=[];this.autoAddAllModelFieldsAsColumns=true},withDefaultColumns:function(c){if(a.isArray(c)){this.defaultColumns=this.defaultColumns.concat(c)}return this},withSortableColumns:function(c){this.sortable=c;return this},shouldAutoAddAllModelFieldsAsColumns:function(c){this.autoAddAllModelFieldsAsColumns=c;return this},build:function(d){var e=a.Array.map(this.defaultColumns,function(g){if(a.isString(g)){return Rally.ui.grid.FieldColumnFactory.getColumnConfigFromField(d.getField(g),this.sortable)}return g},this);if(this.autoAddAllModelFieldsAsColumns){var c=this._buildModelColumns(d,this.defaultColumns,e);e=e.concat(c)}this._removeHiddenColumns(e);return this._stripTagsFromColumnText(e)},_removeHiddenColumns:function(d){for(var c=d.length-1;c>0;c--){var e=d[c];if(e.modelField&&e.modelField.hidden){a.Array.erase(d,c,1)}}}
Not sure what other guidance I can provide to help locate this issue.
The code was a bit large, so I started to do some divide and conquer before I posted it and I found the cause in my code, though probably not the root cause:
In my columnCfgs when adding the rallygrid, I had a trailing ',' on the last entry.
The really annoying thing is this works in all browsers locally, but only fails in IE on Rally with a super obscure error, so its really hard to chase down...even my JavaScript syntax highlighter did not warn me...
I suspect this is actually a problem in either Rally or EXT-JS code where IE is just really finicky...
According to the section 'The Controller-View Relationship' located in http://www.recessframework.org/page/controlling-the-controller :
Try removing the body of the printIt method and refresh to get an error indicating no view template at 'helloWorld/views/printIt.php' can be found.
I tried this and upon refreshing the page, saw []. I checked the response header and it was of type application/json. Could this have something to do with it? I've tried installing Recess on another machine and it resulted in the same behavior.
Can someone tell me how to get an error???