Expected 'styles' to be an array of strings.
See original GitHub issueBug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x)
- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
Angular CLI: 7.1.2 Node: 10.13.0 NPM: 6.4.1 OS: Windows 10 x64 Angular: 7.1.2
Repro steps
ng new my-app --routing --style SCSS cd my-app ng serve
Open http://localhost:4200/ in Chrome
The log given by the failure
This error is logged on the browser console:
Uncaught Error: Expected 'styles' to be an array of strings.
at assertArrayOfStrings (compiler.js:9200)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNonNormalizedDirectiveMetadata (compiler.js:18141)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getEntryComponentMetadata (compiler.js:18786)
at compiler.js:18446
at Array.map (<anonymous>)
at CompileMetadataResolver.push../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata (compiler.js:18446)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._loadModules (compiler.js:25715)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:25696)
at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync (compiler.js:25656)
at CompilerImpl.push../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:143)
Desired functionality
The sample application should be displayed. Instead a white page is displayed and the error above is logged to the console.
Mention any other details that might be useful
Nothing was changed in the application after creating it using ng new. Using ng build and accessing the application through IIS leads to the same results.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top Results From Across the Web
Angular 7 "expected 'styles' to be an array of strings"
I tried messing around with the syntax and checked my angular.json file. import { Component } from '@angular/core'; @Component ...
Read more >"Expected 'styles' to be an array of strings." when a stylesheet ...
This is a bug, but a hard one to fix... it happens because we need to identify which files are loaded in one...
Read more >Error: Expected 'styles' to be an array of strings - YouTube
angular: Error: Expected ' styles' to be an array of stringsThanks for taking the time to learn more. In this video I'll go...
Read more >Javascript – Angular 7 “expected 'styles' to be an array of strings”
compiler.js:7992 Uncaught Error: Expected 'styles' to be an array of strings. ... I tried messing around with the syntax and checked my angular.json...
Read more >Component compiling problem - Material Design for Bootstrap
Package is installed, webpack successfully bundled all we need, but on site startup i got : Expected 'styles' to be an array of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I got this as well in the process of upgrading to Angular 7 and upgrading various dependencies to their latest versions. I found that using raw-loader version 2.0.0 was causing this error even though my styleUrls were correct syntax. Downgrading to raw-loader version 1.0.0 resolved this issue. I don’t know if this helps in the above situation.
I also saw this same error when I upgrade raw-loader to 2.0.0. Back to 1.0.0 removed this error as well.