question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expected 'styles' to be an array of strings.

See original GitHub issue

Bug 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:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

10reactions
jacobbuck72commented, Apr 1, 2019

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.

3reactions
JoelParkecommented, Jun 5, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found