Closed elion closed 6 years ago
I can confirm this bug. I have exactly the same issue.
For me it appeared as soon as I updated to version 1.7, the issue was not in 1.6.
Same here with v1.7.0.
1.7 is broken. Reverting to 1.6.
@wonkim00 did that work for you?
Same, 1.7.0 caused failing builds, pinned version to 1.6.0, builds are passing again.
This appears to be caused by an issue with the processing of the content of certain url encoded inlined svgs. Can someone experiencing this issue provide a minimal reproduction or an svg sample file that exhibits the problem?
@clydin I am unable to.
@nidhididi Yes. After deleting the node_modules folder, editing to "@angular/cli": "~1.6.0" in package.json, and running npm install again (which pulled cli 1.6.8), ng build ran successfully.
@wonkim00 thank you, I also had success with cli 1.6.8
I'm having the same issue and it's something to do with the postcss-cli-resources
plugin. Apparently, it doesn't quite support background
properties with multiple backgrounds, if the last one is not a URL.
Example:
b {
background:
url('./assets/icons/columns.svg'),
linear-gradient(to top, #0f322c 84%, #071a16 99%);
}
Will get compiled to:
b {
background: url('columns.<hash>.svg');
}
@clydin this is the commit that caused my regression (and possibly the others in this thread): https://github.com/angular/angular-cli/commit/eb102275bdd1a05369ff2d1c588ee4040ef0c45d
I am getting the same error with single svg background url.
This is happening with SVG only.
Happen with src: local('Material Icons'), local('MaterialIcons-Regular'), url(../../assets/fonts/material-icon.woff2) format('woff2');
too with v 1.7.1
Ok. Just wrap url content inside "", fix the problem
ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/styles.scss (Emitted value instead of an instance of Error) CssSyntaxError: /Users/json/OneDrive/MyProjects/ArtNgCore/node_modules/material-design-icons/iconfont/material-icons.css:10:12: Can't resolve '../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf)%20format(%27truetype%27' in '/Users/json/OneDrive/MyProjects/ArtNgCore/src'
8 | url(MaterialIcons-Regular.woff2) format('woff2'), 9 | url(MaterialIcons-Regular.woff) format('woff'),
10 | url(MaterialIcons-Regular.ttf) format('truetype'); | ^ 11 | } 12 |
ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/styles.scss (Emitted value instead of an instance of Error) CssSyntaxError: /Users/json/OneDrive/MyProjects/ArtNgCore/node_modules/material-design-icons/iconfont/material-icons.css:8:12: Can't resolve '../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff2)%20format(%27woff2%27' in '/Users/json/OneDrive/MyProjects/ArtNgCore/src'
6 | src: local('Material Icons'), 7 | local('MaterialIcons-Regular'),
8 | url(MaterialIcons-Regular.woff2) format('woff2'), | ^ 9 | url(MaterialIcons-Regular.woff) format('woff'), 10 | url(MaterialIcons-Regular.ttf) format('truetype');
ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/styles.scss (Emitted value instead of an instance of Error) CssSyntaxError: /Users/json/OneDrive/MyProjects/ArtNgCore/node_modules/material-design-icons/iconfont/material-icons.css:9:12: Can't resolve '../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff)%20format(%27woff%27' in '/Users/json/OneDrive/MyProjects/ArtNgCore/src'
7 | local('MaterialIcons-Regular'), 8 | url(MaterialIcons-Regular.woff2) format('woff2'),
9 | url(MaterialIcons-Regular.woff) format('woff'), | ^ 10 | url(MaterialIcons-Regular.ttf) format('truetype'); 11 | }
Same issue as @embryologist Referring to files via css url() without "" causes the build to crash. This should work, as it has a different meaning when using for example sass.
Can confirm that it's not working in 1.7.1
1.7.1
is solving the issue for me, thanks a lot @clydin
1.7.1 did not fix the issue for me. I had to roll back to 1.6.0. I'm seeing the error on unquoted urls for fonts.
@smoke Would you please reopen this issue, as mentioned above, unquoted urls in css and sass are not working.
Same error , please reopen this issue
Same issue with 1.7.1
For everyone still having issues with unquoted url functions, a fix has been merged in master (#9738) and will be available in 1.7.2 which will be released this week.
Still having the issue with 1.7.2 My file:
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url('MaterialIcons-Regular.eot'); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url('MaterialIcons-Regular.woff2') format('woff2'),
url('MaterialIcons-Regular.woff') format('woff'),
url('MaterialIcons-Regular.ttf') format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}
@Polyterative Try targeting es5 in your ts file. It solved my problem, but it's not a long term solution.
Solved by calling containing folder Material_IconFont
instead of Material IconFont
.
In my case the space was causing issues
I'm having the same issue :-(
@Polyterative Yea, you can not have any spaces in your url, especially if you have unquoted uses.
im having the same issue:
ERROR in ./src/app/cemex/cmx_dropdown/components/dropdown-item/cmx-dropdown-item.component.scss (Emitted value instead of an instance of Error) CssSyntaxError: C:\Users\irwin\Documents\Projectos\TestCEMEX\src\app\cemex\cmx_dropdown\assets\scss_font-icons.scss:15:8: Can't resolve './../fonts/dls-icons.svg' in 'C:\Users\irwin\Documents\Projectos\TestCEMEX\src\app\cemex\cmx_dropdown\components\dropdown-item'
the code i have is this
src: url('./../fonts/dls-icons.eot'); src: url('./../fonts/dls-icons.eot') format('embedded-opentype'), url('./../fonts/dls-icons.ttf') format('truetype'), url('./../fonts/dls-icons.woff') format('woff'), url('./../fonts/dls-icons.svg') format('svg');
Try removing "-" in urls. If that does not solve the problem, we might still have an issue with svg.
I changed the name and then still problem.
**ERROR in ./src/app/cemex/cmx_dropdown/components/dropdown-item/cmx-dropdown-item.component.scss (Emitted value instead of an instance of Error) CssSyntaxError: C:\Users\irwin\Documents\Projectos\TestCEMEX\src\app\cemex\cmx_dropdown\assets\scss_font-icons.scss:12:7: Can't resolve './../fonts/icons.woff' in 'C:\Users\irwin\Documents\Projectos\TestCEMEX\src\app\cemex\cmx_dropdown\components\dropdown-item'
10 | 11 |
12 | src: url('./../fonts/icons.woff') format('woff');**
my code is
@font-face { font-family: 'dls-icons'; url('./../fonts/icons.woff') format('woff'); font-weight: normal; font-style: normal; }
The folder "fonts", is it included in angular-cli.json file as a static folder?
You can navigate to localhost:4000/webpack-dev-server to see if your targeting folder was correctly emitted and if your given don't url points to that folder.
The problem I'm currently having looks much like this issue. Here's the output
ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/styles.scss
Module build failed: Error: Can't resolve 'node_modules/font-awesome/css/font-awesome.css'
this one doesnt show anything: localhost:4000/webpack-dev-server
and did a downgrade to 1.7.0 and still having the problem.
IDK what you mean with this: The folder "fonts", is it included in angular-cli.json file as a static folder
where do i add this folder and how?? any example please??
When running my serve you can view the output in the browser by navigating to localhost:4000/webpack-dev-server (or another port if you have changed it).
Yes, in the included angular-cli.json file, you can add the name of your folder in quotes to tell angular not to bundle these file (leave as is). More information about this can be found here https://github.com/angular/angular-cli/wiki/angular-cli
If your case, you might have to add "fonts" To the apps -> assets array
Im getting this too, and I have no SVGs. Worked fine in 1.6.0. Not working in 1.7.3.
The error is misleading, as it says it cannot find a variable $primary
which is indeed in my styles folder.
ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/styles/styles.scss
Module build failed:
$primary-color: map-get($primary, 400);
^
Undefined variable: "$primary".
in /Users/papa/_git/ngrx-data-lab/src/styles/mixin.scss (line 8, column 27)
I created a new issue for this #9928
Is there an actual fix for this? Still not working for me with 1.7.3.
Still getting this error in 1.7.3
ERROR in ./src/app/app.component.css (Emitted value instead of an instance of Error) CssSyntaxError: C:\Users\XXXXXX\Documents\WebStorm\Admin\src\assets\css\theme-default.css:771:26: Can't resolve '../img/logo-small.png' in 'C:\Users\SSSSSS\Documents\WebStorm\Admin\src\app'
@johnpapa @kolexinfos @ORIGINALUSRNM Probably same as this: https://github.com/angular/angular-cli/issues/9943
You need to lock your node-sass
My issue was not with node-sass was with the version of webpack that is in use at the time.
The @angular/cli@1.7.3 uses Webpack@3.11 which does not recognize.
I had to downgrade to @angular/cli@1.5.6 which uses @webpack@3.8 which built the project successfully.
I'm on @angular/cli 1.7.4 and I've had the same issue while I was trying to load fonts.
I fixed the problem by assigning url value to scss variable, hope it helps!
$font_src-bold: url("./assets/fonts/SF-UI-Display-Bold.otf");
@font-face {
font-family: "SF Pro Display";
font-weight: 700;
src: $font_src-bold;
}
I have similar issue with angular/cli 1.7.4 -
(Emitted value instead of an instance of Error) CssSyntaxError: /Users/xxx/xxx/website/web-src/app/pages/home-page/home-page.component.scss:104:30: Can't resolve ../../../../node_modules/assets/images/background.svg' in '/Users/xxx/xxx/website/web-src/app/pages/home-page
102 | }
103 | &.bg-1 {
> 104 | background-image: url("~/assets/images/background.svg");
| ^
105 | }
106 | }```
Can you point me to some fix? Version 1.6.3 works good, but i need some fix from 1.7 :(
@jakubjosef Check what version of node-sass
you are running, I bumped my version up from 4.8.1 to 4.8.3 and it solved my issue.
@jakubjosef if the file is a copied asset then the tilde should not be used. Otherwise the output will contain two copies of the file. If this is not the case then the path should be relative to the containing stylesheet's location.
The tilde should in general be avoided as it happens to work currently due to the underlying presence and configuration of webpack but is not guaranteed to work moving forward.
Do you guys have only the problem with svg? I have the same error as others using svg, png. Is there any workaround to this bug? I need 1.7.4 so I don't wont to go back to 1.6. @RandomUser0912421 - your's solution isn't working too - the same error
@clydin Thanks for proposal, but it's not work. I still have node_modules in path :(
Guys, Did you try to specify path in this way? For me it's working fine.
$icon: url("/../../../../../assets/local_florist.png");
.icon {
background: $icon;
}
"@angular/cli": "^1.7.3"
has this been solved?
They tried npm rebuild node-sass --force
?
@MaciejWWojcik yes, this is exactly the workaround i used. @pacozevallos yes, didn't help.
Same issue with angular/cli 1.7.1
Versions
Error occurs since v1.7.0-rc.0
Observed behavior
I get similar error messages for each svg file. The page.css is listed in angular-cli.json styles array.
Repro steps
Possible breaking commits: https://github.com/angular/angular-cli/commit/4a745c9 https://github.com/angular/angular-cli/commit/fa175d8