-
Notifications
You must be signed in to change notification settings - Fork 12k
Initiate AOT compilation from the command line using ngc is failing Error : Expected 'stylesUrls' to be an array of strings. Angular 4 #6002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The CLI ( |
@clydin this is using AOT that is in an existing project. What help does your instructions provide? |
if you are not using the CLI then the appropriate repository to open an issue concerning your problem is angular/angular which maintains the 'ngc' tool. |
On CLI projects you don't use |
Late to the party, but I had this issue caused by including a css file twice, once in the angular-cli.json's styles array, and once in a particular component's styleUrls array. Apparently the cli's webpack sees the filename/filepath that it already recognizes in the component and wraps/replaces the filepath string with something like __webpack__require(filepath) which is obviously not the string the styleUrls property was looking for. Fix is to remove it from one of those locations. (Assuming you don't have it on multiple components. In that case, remove it from angular-cli.json) Even a slight change to the filepath could fix it. Changing one of them from xxx.min.css to just xxx.css would cure the error, even though you wouldn't want it twice in your project. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Output from:
ng --version
."@angular/compiler-cli": "4.0.2",
node v7.9.0
macOS ( Sierra?)
Simple steps to reproduce this bug.
Please include: commands run, packages added, related code changes.
A link to a sample repo would help too.
following the steps here https://angular.io/docs/ts/latest/cookbook/aot-compiler.html
this command is run:
node_modules/.bin/ngc -p tsconfig-aot.json
The log given by the failure.
Error: Expected 'styleUrls' to be an array of strings.
at assertArrayOfStrings (/Users/xxxxx/xxxxx/xxxxx/xxxxx/node_modules/@angular/compiler/bundles/compiler.umd.js:3361:19)
at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (/Users/xxxxx/xxxxx/xxxxx/xxxxx/node_modules/@angular/compiler/bundles/compiler.umd.js:13786:13)
at CompileMetadataResolver._getEntryComponentMetadata (/Users/xxxxx/xxxxx/xxxxx/xxxxx/node_modules/@angular/compiler/bundles/compiler.umd.js:14484:45)
at /Users/xxxxx/xxxxx/xxxxx/xxxxx/node_modules/@angular/compiler/bundles/compiler.umd.js:14470:48
at Array.forEach (native)
at CompileMetadataResolver._getEntryComponentsFromProvider (/Users/xxxxx/xxxxx/xxxxx/xxxxx/node_modules/@angular/compiler/bundles/compiler.umd.js:14469:30)
at /Users/xxxxx/xxxxxx/xxxxx/frontend/node_modules/@angular/compiler/bundles/compiler.umd.js:14433:83
at Array.forEach (native)
at CompileMetadataResolver._getProvidersMetadata (/Users/xxxxxxx/xxxxxx/xxxxxxx/xxxxxx/node_modules/@angular/compiler/bundles/compiler.umd.js:14397:19)
at /Users/xxxxxx/xxxxxxxxx/xxxxxxx/xxxxxx/node_modules/@angular/compiler/bundles/compiler.umd.js:14399:23
Compilation failed
Desired functionality.
it should work
Mention any other details that might be useful.
I am using angular 4.0.2 and it's components
The text was updated successfully, but these errors were encountered: