Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - ERROR: PostCSS received undefined instead of CSS string

Trying to build an Angular project and I'm getting the errors below. This project built fine last week. I made some changes to other projects that use the Dlls from this project, but no changes to this project. I already spent a lot of time troubleshooting it with no luck and appreciate any help.

ERROR: PostCSS received undefined instead of CSS string An unhandled exception occurred: PostCSS received undefined instead of CSS string

like image 576
Sohi Avatar asked Jul 02 '20 21:07

Sohi


3 Answers

This can sometimes happen if node-sass was compiled for a different version of Node.js than you're currently running (ie if you've recently changed your Node.js version). You can fix that with:

npm rebuild node-sass
like image 139
Alec Avatar answered Oct 16 '22 14:10

Alec


if you are using webpack, and trying to use sass-loader, also add sass

like image 31
noreply Avatar answered Oct 16 '22 14:10

noreply


I had this same issue when attempting to test an Angular library, and the issue was I had [``] instead of [] in the styles property of my component metadata.

Wrong

@Component({
selector: 'my-input',
template: `
  <input
  ... />
  `,
styles: [``],

Right

@Component({
selector: 'my-input',
template: `
  <input
  ... />
  `,
styles: [],
like image 13
Jadamae77 Avatar answered Oct 16 '22 14:10

Jadamae77