-
Notifications
You must be signed in to change notification settings - Fork 12k
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
TypeError: Cannot read property 'text' of undefined #8216
Comments
A bit more data--I went through my code, and found every instance (not many) where I tried to refer to |
I tried making template and whitespace changes but I don't see this. Can you put up a repro please, or show me how I can see this happening in a new project overall? |
I can try. My project is quite large, and because of the nature of the error, there is no indication where in the project the bug occurs. |
@filipesilva OK, I have a repo for you. As I said, because of the nature of the error, I didn't know how to make a minimal repro. But this reproduces both the error reported in this issue and in #8207, I believe. Because this is not an open source project, I've added your public key from github so that you alone can access this. If anyone else from the project needs access, let me know, and I'll add their keys as well. If I did this right (not 100% certain that I did), you should be able to clone from here:
the do
then make a trivial change in to reproduce #8207, just do I may continue to fiddle with it and push new updates, but not for too long--it is board game day here. :-) Let me know if you have trouble accessing the repo or reproducing the issues. |
Given the references to the other issues I assume you're already thinking this is related to AOT. So just to make it explicit: the problem goes away when using (Angular 5.0.0-rc.8, Angular CLI 1.5.0-rc.6.) |
as mentioned here, #8207 (comment), rc.8 seems to have fixed the bug with AOT described above, but an issue with --no-aot persists (and can still be reproduced with the repo above). |
Again just to be clear, despite what's being said in that other issue, for me it's the other way around for rc.8:
So, it might not be related to those flags at all...? (Angular 5.0.0-rc.8, Angular CLI 1.5.0-rc.6 on both OS X and Windows 7. Will test with rc.9 today.) |
@avbentem can you try @karptonite I cloned your project, updated Running
Running I also observed around 9s rebuilds (this is relevant for me in the context of #8259). I went to look at those files, and it seems like that those two libraries ( To see if I could get around that, I deleted the TS files from those two libraries and tried building again. This resulted in two warnings:
I checked the source javascript files for those libraries and they use SystemJS. I'm sorry to say that those two libraries are not well packaged and not supported by the build system as is... Can you perhaps use something else instead? BTW great work on https://boardgamegeek.com/, I always go there for board game reviews! |
@filipesilva I'm sure I could find replacement libraries, or fix (or convince the maintainers to fix) the existing packages. Remember that these are working with AOT builds; does this mean that when they are built with AOT, they are larger and/or slower to build? Or maybe they seem to compile, but there are some subtle problems that will show up at run time? Also recall that they worked with the no-AOT build system until recently. Has something about the build system changed to make such packages now unusable, in which case this should at least be listed as a breaking change. Considering that I happened to have two such packages in my relatively small app suggests that such packages aren't that uncommon, so this may become an irritation in terms of reported issues if the build system continues to be unable to support packages it used to work with. |
@karptonite can I post the CPU profile of a rebuild of your app in #8259? Since I was debugging it I had a look and it could help us make rebuilds faster. It doesn't contain any identifying information that I can see, just CLI function names. It is true that it worked with CLI up until now, and that it still works with 1.5 when using AOT. This is something I'll escalate today to see what the official answer is. As far as I can tell, the previous build system just wasn't very strict with them but they weren't really AOT compatible. I'll let you know when I have a better answer. |
Sure, go ahead. I'd love for it to build faster! Did you mean that previously my AOT builds with these would have failed in runtime, but now they work? Also, if anyone else needs access to that repo, let me know--I can quickly add more public keys. |
I'm not sure if it would have failed before. I suspect that maybe the library was being built with the app. But it could break anytime because the TS version your app uses is not necessarily the same as the one the library uses. Now the non-AOT mode sees the file isn't part of your TS project and fails. But the AOT build seems to be emitting the file still, which is something I'll have to bring up with the compiler team. |
Ah, my bad (I feel really stupid), you were (of course) referring to Angular CLI RC8, not Angular 5 RC8... So: For (Angular 5.0.0-rc.9, Angular CLI 1.5.0-rc.8 on Windows 7. And totally as an aside: https://github.com/angular/angular-cli/releases shows me RC6 on top of the page (screenshot), but also a link to "Show 2 newer tags", which indeed then reveals RC7 and RC8 (screenshot). Maybe hidden as there are no release comments?) |
@avbentem glad to hear that version sorts it for you 👍 You're right, we forgot to add the release notes to those two. I'll get on it. |
@filipesilva Any official word on this issue: #8216 (comment) ? The packages that are breaking no-aot (but not aot), and which maybe aren't really working with aot? |
@karptonite I added a comment in #8263 to give an update on what's going on: To give you all an update on the issue, @hansl is trying to work with the library authors of known problematic libraries to sort these issues out. |
@filipesilva In that case, I'm closing this issue in favor of #8263. The original issue with "Cannot read property 'text'..." on rebuild in AOT is fixed, and it looks like the other issue is where you are handling the problematic libraries. |
Was there something reverted regarding this issue? I'm getting this error with 1.6.2 |
I'm getting this error in 1.6.2 as well. |
Can you open a new issue and provide the full command line used that causes the error? |
#metoo @1.7.2 |
get same error in angular-cli@1.7.2 |
Getting the same in |
I've tested each version from |
+1 angular-cli@1.7.2 |
+1 angular-cli@1.7.4 |
Easy fix for now is |
Maybe obvious, but just in case: I am no longer getting this error in Angular CLI 6.0.x (with AOT in an Angular 6 project). |
Have been struggling with this issue for a couple of days now and finally solved it after no other solution worked for me. I've opened the file typescript.js and went to the function "transformCommonJSModule" that appears in the error's stack trace. I've added console.log("####", node) to the beginning of the function, logging the function's parameter, node. I went to that file and checked what changes I made to it when the bug first appeared. It seems this bug can be caused by different things. The process I described above can help narrow down what the cause is. Good luck! |
Thanks, @shaizel for your suggestion it helped me track down what was causing this error for me. For anyone like me coming to this and running a hybrid AngularJS and Angular application. Try removing the |
I'm running into this, what specifically in @types/angular is breaking thinks @k0nG ? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
Repro steps.
in my package, anyway
ng serve --ssl --public-host=//localhost:4200/sockjs-node/ --deploy-url=//localhost:4200/ --serve-path=/
make a trivial change to a template
The log given by the failure.
Desired functionality.
Successful compilation
Mention any other details that might be useful.
After the first build, everything works correctly. But a trivial change to a template or a change to whitspace in a ts file gives the error shown.
The text was updated successfully, but these errors were encountered: