Ng build fails. CssSyntaxError since 1.7.0-rc.0
Versions
Error occurs since v1.7.0-rc.0
Angular CLI: 1.7.0-rc.0
Node: 8.9.4
OS: win32 x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.7.0-rc.0
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0-rc.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript: 2.6.2
webpack: 3.10.0
Observed behavior
ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/assets/styles/page.css
(Emitted value instead of an instance of Error) CssSyntaxError: C:\Users\{omitted}\angular-project\src\assets\styles\page.css:259:2159: Can't resolve '%23linearGradient-1' in 'C:\Users\{omitted}\angular-project\src\assets\styles'
> 259 | background: transparent url("../img/icon.svg") no-repeat 50% 0; ^
260 | }
I get similar error messages for each svg file. The page.css is listed in angular-cli.json styles array.
Repro steps
ng build
Possible breaking commits: https://github.com/angular/angular-cli/commit/4a745c9 https://github.com/angular/angular-cli/commit/fa175d8
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
Stoped seeing weird behaviors after upgrading to Angular 6.0
Warning: the path it´s not relative to the partial .scss file
For many people the error will be caused when trying to load a resource relative to the file. What Webpack is doing is trying to resolve the paths relative to the entry file.
You can put the SVGs or webfonts inside the assets folder and update the path accordingly.
NG Sass build fails still for the same reason. Configuration:
{ npm: '6.4.1',
ares: '1.10.1-DEV',
cldr: '32.0',
http_parser: '2.7.0',
icu: '60.1',
modules: '57',
nghttp2: '1.25.0',
node: '8.10.0',
openssl: '1.0.2n',
tz: '2017c',
unicode: '10.0',
uv: '1.19.1',
v8: '6.2.414.50',
zlib: '1.2.11' }
Angular 6 stable and latest angular client. MacOSX on iMac and Macbook Pro. The scenario is a I want to include bulma-extensions. When in my style.sass I do
@import '~bulma'
@import '~bulma-extensions'
result is:
ERROR in ./src/styles.sass (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--15-3!./src/styles.sass)
Module build failed: Not enough space
Anyone found a fix for this? does going back to 1.6-rc.0 fixes the error?
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.