-
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
build --localize error: Cannot read property 'startTag' of null #17019
Comments
Some further comments: |
Fwiw I have no issues on our project using 3 languages. We also use build time translations. Our project also upgraded from ng8->ng9 What happens if you remove all code except your main module? Same error? What happens with a minimal translation file containing 1 translation? What does angular json look like? Have you tried configuring localization there? |
Hi @jnso, unfortunately there is not enough information to perform an investigation. Could you please try to isolate which part of the template is causing the problem? You can try removing elements from your template until the problem goes away - that way you should be able to identify minimum template that triggers the issue. Thank you. |
Hi, thanks for your ideas. So, I stripped my project down and finally got it to work. The problem I had for some reason managed to put a link-tag outside of the html tag looking like this: <!doctype html>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<html lang="en">
....
</html> Once I moved the link tag to its correct position it worked fine. I guess this is really a user handling error. However, given the weird behavior and error maybe some action is required anyway. Since this caused me to believe it was a i18n issue. |
Hi @jnso, thanks for the update. The error message is a bit unexpected for the case that you described, so if you could provide a minimum repro with i18n configuration that you used and minimum possible |
@AndrewKushnir Instructions how how to reproduce the error is in the README.md file. Let me know if you need more information. |
Hi @jnso, thanks for the repro. It looks like the problem was caused by Angular CLI logic that updates |
Hello I am facing the same issue but, my index.html is all fine. |
Hi @sanketswani, could you please create a minimum repro (in a form of Github repo), so that we can investigate the problem further? Thank you. |
@AndrewKushnir Please find below repo of the same. |
I have found the problem in this case (at least in the reproduction provided). So in both these cases, the problem was that the index.html was not formatted correctly (or at least as expected). I think the action from all of this is that the CLI should report a clearer error message when the |
For what it is worth here is the file where the error occurs: Line 62 in d0ede14
|
…ream instead of parse5-htmlparser2-tree-adapter Closes: #17019
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
Affected Package
The issue is probably caused by package @angular/localize/
Is this a regression?
Yes, the previous version in which this bug was not present was: 8.3.24
Description
When building with
ng build --localize
The build crashes at the end with exit code 1 and the message:
Cannot read property 'startTag' of null
If I omit the 'localize' flag, the build succeeds.
If I run 'ng serve --configuration=' It works just fine.
Console output
[...]
Localized bundle generation complete.
chunk {2} polyfills-es2015.09511dbf2d8d4095a5eb.js (polyfills) 35.7 kB [initial] [rendered]
chunk {3} polyfills-es5.daf0c38b3a8d40ca8fbc.js (polyfills-es5) 127 kB [initial] [rendered]
chunk {1} main-es2015.3d599b43b9ca01c039de.js (main) 1.21 MB [initial] [rendered]
chunk {1} main-es5.3d599b43b9ca01c039de.js (main) 1.38 MB [initial] [rendered]
chunk {0} runtime-es2015.6bd75c31c397efcb90d9.js (runtime) 1.45 kB [entry] [rendered]
chunk {0} runtime-es5.6bd75c31c397efcb90d9.js (runtime) 1.45 kB [entry] [rendered]
chunk {4} styles.fac3127509e320d31319.css (styles) 72.2 kB [initial] [rendered]
Date: 2020-02-13T12:42:21.857Z - Hash: 1319cd48dd54c1cf42f3 - Time: 66232ms
Cannot read property 'startTag' of null
Dist folder
index.html is missing from the dist folder
🔬 Minimal Reproduction
Sadly, I have not been able to get to the root cause and cannot provide a good minimal repo for this issue. Greatly appreciate comments on how to investigate where the error originates from.
🔥 Exception or Error
Exit code: 1
🌍 Your Environment
Angular Version:
Anything else relevant?
I did try to remove all tags in messages..xlf. Same error (with lots of warning of missing tags of course).
The text was updated successfully, but these errors were encountered: