When using angular12 (version 12.0.3) to develop a project, the debugging will run normally, but an error message will appear when calling ng build to publish.
Tip: index HTML generation failed undefined:6:720366 missing ‘}’
Or: index HTML generation failed Undefined: 6:720366 missing ‘:’ etc.
The solution is to modify the angular.json configuration file, Add an optimization node under the build -> configurations ->production node:
"optimization": {
"scripts": true,
"fonts": {
"inline": true
},
"styles": {
"minify": true,
"inlineCritical": false
}
}
The complete node path is:
{
...,
"projects":{
"myapp":{
...,
"architect":{
...,
"build":{
...,
"configurations":{
...,
"production": {
...,
"optimization": {
"scripts": true,
"fonts": {
"inline": true
},
"styles": {
"minify": true,
"inlineCritical": false
}
}
}
},
...
},
...
},
...
}
},
...
}
Read More:
- How to Solve Angular Error: error NG8002: Can‘t bind to ‘ngModel‘ since it isn‘t a known property of ‘input‘.
- [Solved] jinja2.exceptions.TemplateNotFound: index.html
- [Solved] Angular build Error: throw er; // Unhandled ‘error’ eventEmitted ‘error’ event on ChildProcess instance
- [Solved] URIError: Failed to decode param ‘/%3C%=%20BASE_URL%20%3Estatic/index.%3C%=%20VUE_APP_INDEX_CSS_HASH%20%3E.css’
- [Solved] Kafka Start Log Error: WARN Found a corrupted index file due to requirement failed: Corrupt index found
- [Solved] HTML report error, httprunner 3. X HTML report error, oserror: [winerror 6] handle invalid (resolved)
- Notes on atom editor_ (11) Editor previews HTML page in real time (add in: atom HTML preview)
- Jenkins uses NPM to build Vue error, and the manual build is normal
- How to Solve Docker ERROR: Service’workspace’ failed to build: ERROR: Service’php-fpm’ failed to build
- Markdownpad2 Error: Html Rendering Error (An error occurred with the Html rendering component.)
- How to Solve Import antd Error: Module build failed
- [Solved] Vcpkg Install Building package brotli:x64-windows failed with: BUILD_FAILED Locking applocal.ps1
- Failed to find Build Tools revision 30.0.3 [How to Solve]
- Module build failed: Error: Node Sass version 6.0.0 is incompatible with ^4.0.0
- [Solved] Flutter compile error: Failed to find Build Tools revision 29.0.2
- How to Solve MVC Error: Build failed.
- [Solved] error: failed to run custom build command for `librocksdb-sys v6.17.3`
- [Solved] Unity Package Error: FAILURE: Build failed with an exception.
- Angular Error: No value accessor for form control with name ‘xxx’