angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Index html generation failed. `property missing ':'`

Open kemsky opened this issue 5 years ago β€’ 38 comments

🐞 Bug report

Command (mark with an x)

  • [ ] new
  • [x] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] extract-i18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Is this a regression?

Yes

Yes, the previous version in which this bug was not present was: ^11.0.0

Description

Build fails, the error message is misleading:

√ Browser application bundle generation complete.
√ Copying assets complete.
Γ— Index html generation failed.
undefined:1:1234: property missing ':'

πŸ”¬ Minimal Reproduction

https://github.com/kemsky/angular-cli-bug

This CSS breaks the build:

/**
This document validates as CSS level 3 + SVG !
**/
.tox-rtc-remote-image {
  background: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2236%22%20height%3D%2212%22%20viewBox%3D%220%200%2036%2012%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Ccircle%20cx%3D%226%22%20cy%3D%226%22%20r%3D%223%22%20fill%3D%22rgba(0%2C%200%2C%200%2C%20.2)%22%3E%0A%20%20%20%20%3Canimate%20attributeName%3D%22r%22%20values%3D%223%3B5%3B3%22%20calcMode%3D%22linear%22%20dur%3D%221s%22%20repeatCount%3D%22indefinite%22%20%2F%3E%0A%20%20%3C%2Fcircle%3E%0A%20%20%3Ccircle%20cx%3D%2218%22%20cy%3D%226%22%20r%3D%223%22%20fill%3D%22rgba(0%2C%200%2C%200%2C%20.2)%22%3E%0A%20%20%20%20%3Canimate%20attributeName%3D%22r%22%20values%3D%223%3B5%3B3%22%20calcMode%3D%22linear%22%20begin%3D%22.33s%22%20dur%3D%221s%22%20repeatCount%3D%22indefinite%22%20%2F%3E%0A%20%20%3C%2Fcircle%3E%0A%20%20%3Ccircle%20cx%3D%2230%22%20cy%3D%226%22%20r%3D%223%22%20fill%3D%22rgba(0%2C%200%2C%200%2C%20.2)%22%3E%0A%20%20%20%20%3Canimate%20attributeName%3D%22r%22%20values%3D%223%3B5%3B3%22%20calcMode%3D%22linear%22%20begin%3D%22.66s%22%20dur%3D%221s%22%20repeatCount%3D%22indefinite%22%20%2F%3E%0A%20%20%3C%2Fcircle%3E%0A%3C%2Fsvg%3E%0A");
}

.mce-spellchecker-word {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D'4'%20height%3D'4'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cpath%20stroke%3D'%23ff0000'%20fill%3D'none'%20stroke-linecap%3D'round'%20stroke-opacity%3D'.75'%20d%3D'M0%203L2%201%204%203'%2F%3E%3C%2Fsvg%3E%0A");
}

πŸ”₯ Exception or Error


Γ— Index html generation failed.
undefined:1:1234: property missing ':'

🌍 Your Environment


Angular CLI: 12.0.0
Node: 14.15.3
Package Manager: npm 6.14.9
OS: win32 x64

Angular: 12.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0
@angular-devkit/build-angular   12.0.0
@angular-devkit/core            12.0.0
@angular-devkit/schematics      12.0.0
@schematics/angular             12.0.0
rxjs                            6.6.7
typescript                      4.2.4

kemsky avatar May 13 '21 11:05 kemsky

I started getting this error after updating to version 12 from version 9 ( 9 -> 10 -> 11 -> 12) I used the workarround in production build configuration: "optimization": { "scripts": true, "styles": { "minify": true, "inlineCritical": false }, "fonts": true } and it solved the build problem.

yfathi avatar Jun 25 '21 12:06 yfathi

I've isolated the problem to the same one mentioned by @notbear more specifically, the problem is the styles data urls imported by balloon-css I was using an old version of balloon-css and I've solved the problem by updating it to version 1.2.0 Hope this will help anyone who got the same problem :D

Mekacher-Anis avatar Jul 14 '21 05:07 Mekacher-Anis

I experienced another problem today where the build finished successfully, but the global and imported styles where missing on runtime. Only the component styles were loaded. It was also fixed by adding inlineCritical: false but it's kinda strange.

EinfachHans avatar Jul 15 '21 10:07 EinfachHans

I am using UIkit in my project and after Angular 12 upgrade I started receiving the following error:

 ng build
βœ” Browser application bundle generation complete.
βœ” ES5 bundle generation complete.
βœ” Copying assets complete.
βœ– Index html generation failed.
undefined:15:204028: property missing ':'

After isolating tons of .scss and .css files I found that the following variables in /node_modules/uikit/src/scss/variables-theme.scss are causing this error:

$internal-divider-icon-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22none%22%20stroke%3D%22#000%22%20stroke-width%3D%222%22%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%227%22%20%2F%3E%0A%3C%2Fsvg%3E%0A" !default;
$internal-form-select-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2224%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22#000%22%20points%3D%2212%201%209%206%2015%206%22%20%2F%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22#000%22%20points%3D%2212%2013%209%208%2015%208%22%20%2F%3E%0A%3C%2Fsvg%3E%0A" !default;
$internal-form-datalist-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2224%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22#000%22%20points%3D%2212%2012%208%206%2016%206%22%20%2F%3E%0A%3C%2Fsvg%3E%0A" !default;
$internal-form-radio-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22#000%22%20cx%3D%228%22%20cy%3D%228%22%20r%3D%222%22%20%2F%3E%0A%3C%2Fsvg%3E" !default;
$internal-form-checkbox-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22#000%22%20points%3D%2212%201%205%207.5%202%205%201%205.5%205%2010%2013%201.5%22%20%2F%3E%0A%3C%2Fsvg%3E%0A" !default;
$internal-form-checkbox-indeterminate-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Crect%20fill%3D%22#000%22%20x%3D%223%22%20y%3D%228%22%20width%3D%2210%22%20height%3D%221%22%20%2F%3E%0A%3C%2Fsvg%3E" !default;
$internal-list-bullet-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%226%22%20height%3D%226%22%20viewBox%3D%220%200%206%206%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22#000%22%20cx%3D%223%22%20cy%3D%223%22%20r%3D%223%22%20%2F%3E%0A%3C%2Fsvg%3E" !default;
$internal-nav-parent-close-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolyline%20fill%3D%22none%22%20stroke%3D%22#000%22%20stroke-width%3D%221.1%22%20points%3D%2210%201%204%207%2010%2013%22%20%2F%3E%0A%3C%2Fsvg%3E" !default;
$internal-nav-parent-open-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolyline%20fill%3D%22none%22%20stroke%3D%22#000%22%20stroke-width%3D%221.1%22%20points%3D%221%204%207%2010%2013%204%22%20%2F%3E%0A%3C%2Fsvg%3E" !default;
$internal-accordion-open-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2213%22%20height%3D%2213%22%20viewBox%3D%220%200%2013%2013%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Crect%20fill%3D%22#000%22%20width%3D%2213%22%20height%3D%221%22%20x%3D%220%22%20y%3D%226%22%20%2F%3E%0A%3C%2Fsvg%3E" !default;
$internal-accordion-close-image: "data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2213%22%20height%3D%2213%22%20viewBox%3D%220%200%2013%2013%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Crect%20fill%3D%22#000%22%20width%3D%2213%22%20height%3D%221%22%20x%3D%220%22%20y%3D%226%22%20%2F%3E%0A%20%20%20%20%3Crect%20fill%3D%22#000%22%20width%3D%221%22%20height%3D%2213%22%20x%3D%226%22%20y%3D%220%22%20%2F%3E%0A%3C%2Fsvg%3E" !default;

Not sure where to go next with it.

Hey @ashkue, IΒ΄m also using UiKit in our project and see the same issue. Did you find any promising workaround? The only working thing for us was not to use --configuration prod or --prod anymore.

davidpawar avatar Jul 16 '21 15:07 davidpawar

Hey @davidpawar,

Yes, I managed to fix it by disabling inclineCritical optimization, you can see it here Basically I changed one line in angular.json file from

"optimization": true

with

"optimization": {
    "scripts": true,
    "styles": {
        "minify": true,
        "inlineCritical": false
    },
    "fonts": true
}

pavelsource avatar Jul 16 '21 15:07 pavelsource

Hey @davidpawar,

Yes, I managed to fix it by disabling inclineCritical optimization, you can see it here Basically I changed one line in angular.json file from

"optimization": true

with

"optimization": {
    "scripts": true,
    "styles": {
        "minify": true,
        "inlineCritical": false
    },
    "fonts": true
}

Hey, @ashkue,

ah thx a lot. It was my bad. I changed the wrong optimization property in the angular.json. Now its building again.

davidpawar avatar Jul 16 '21 16:07 davidpawar

Hey @davidpawar,

Yes, I managed to fix it by disabling inclineCritical optimization, you can see it here Basically I changed one line in angular.json file from

"optimization": true

with

"optimization": {
    "scripts": true,
    "styles": {
        "minify": true,
        "inlineCritical": false
    },
    "fonts": true
}

Thank you! That solution fixed a similar issue of mine when building a production version of an ionic app after upgrading Angular to version 12. This was my error:

Ξ» ionic build --prod
> ng.cmd run app:build:production
Warning: Support was requested for IE 11 in the project's browserslist configuration. IE 11 support is deprecated since Angular v12.
For more information, see https://angular.io/guide/browser-support
√ Browser application bundle generation complete.
√ Copying assets complete.
Γ— Index html generation failed.
undefined:1:2054: @font-face missing '}'
[ERROR] An error occurred while running subprocess ng.

        ng.cmd run app:build:production exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

gbrasier avatar Jul 27 '21 19:07 gbrasier

i still get the erro below after change the angular.json. Error: undefined:26168:28: property missing ':'

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

√ Browser application bundle generation complete.

4 unchanged chunks

Build at: 2021-07-30T13:30:22.823Z - Hash: 134f3c30897baa7cc120 - Time: 17129ms

Error: undefined:26168:28: property missing ':'

√ Browser application bundle generation complete.

4 unchanged chunks

Build at: 2021-07-30T13:30:36.239Z - Hash: 134f3c30897baa7cc120 - Time: 12471ms

Error: undefined:26168:28: property missing ':'

anyway how to debug this? thanks

doctordldh avatar Jul 30 '21 13:07 doctordldh

Does anyone know if it's necessary to put the full explicit listing of all properties as suggested multiple times above:

"optimization": {
    "scripts": true,
    "styles": {
        "minify": true,
        "inlineCritical": false
    },
    "fonts": true
}

or can you achieve the same result by defining only only a single property like so and trust that the unmentioned properties will still be set to their defaults ?

"optimization": {
    "styles": {
        "inlineCritical": false
    }
}

Or, in other words, are the following two synonymous:

    "configurations": {
        "production": {
            "optimization": true
        }
    }

and

    "configurations": {
        "production": {
            "optimization": {}
        }
    }

I couldn't find any explanation in the documentation of whether an empty object would be replaced with all the defaults, and hence a partially defined object extended with all the other defaults.

swiss-chris avatar Jul 30 '21 14:07 swiss-chris

Adding just this worked for me:

"optimization": {
    "styles": {
        "inlineCritical": false
    }
}

hadsy avatar Jul 30 '21 14:07 hadsy

i've tried the "optimization" workarounds here (also using UIKit) and am still getting the same error:

βœ– Index html generation failed.
undefined:1:142866: property missing ':'

Not sure what to try next.

IRCraziestTaxi avatar Aug 03 '21 03:08 IRCraziestTaxi

Oops, big fail on my part. I had the "optimization" property in the wrong configuration. Working now. Thanks for the fix!

IRCraziestTaxi avatar Aug 03 '21 03:08 IRCraziestTaxi

It would be nice to have a verbose message that gives more information of the actual issue that is trigging the build error.

raygig avatar Aug 04 '21 23:08 raygig

having the same issue

changhuixu avatar Aug 19 '21 21:08 changhuixu

what's painful here is that you just get a message which says

βœ– Index html generation failed.
undefined:9:396236: property missing ':'

it would be nice if it tells which file is causing the problem with the line number

codecat15 avatar Oct 07 '21 21:10 codecat15

@codecat15 you know what would be even more helpful? If reworkcss/css library was maintained and its bugs were fixed.

hakimio avatar Oct 15 '21 20:10 hakimio

I tripped on this by including "node_modules/@clr/ui/clr-ui.css" in my build

kdubious avatar Oct 18 '21 23:10 kdubious

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.