Skip to content
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

Error: [object Object] is not a PostCSS plugin After updating to Angular 11.1.0 #19839

Closed
mrctrifork opened this issue Jan 21, 2021 · 25 comments · Fixed by #19847
Closed

Error: [object Object] is not a PostCSS plugin After updating to Angular 11.1.0 #19839

mrctrifork opened this issue Jan 21, 2021 · 25 comments · Fixed by #19847

Comments

@mrctrifork
Copy link

🐞 bug report

Affected Package

the application itself

Is this a regression?

Not a regression

Description

I updated my app from Angular 11.0.9 to Angular 11.1.0 because there was a bug with the HttpClient and now it doesn't compile

🔬 Minimal Reproduction

I ran

ng update @angular/cdk @angular/core @angular/cli @angular/material

Process finished successfully

And then tried to ng serve or ng build and yields the output below

🔥 Exception or Error


✔ Browser application bundle generation complete.

Error: ./src/main.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
    at Processor.normalize (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:168:15)
    at new Processor (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:52:25)
    at postcss (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/postcss.js:55:10)
    at Object.loader (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss-loader/dist/index.js:94:41)
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/webpack/lib/NormalModule.js:313:13
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/@ngtools/webpack/src/ivy/loader.js:57:9
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
 @ multi ./src/main.ts main[0]

Error: ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
    at Processor.normalize (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:168:15)
    at new Processor (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:52:25)
    at postcss (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/postcss.js:55:10)
    at Object.loader (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss-loader/dist/index.js:94:41)
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/webpack/lib/NormalModule.js:313:13
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/@ngtools/webpack/src/ivy/loader.js:57:9
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
 @ multi ./src/polyfills.ts polyfills[0]

Error: ./src/bootstrap-grid.min.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
    at Processor.normalize (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:168:15)
    at new Processor (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:52:25)
    at postcss (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/postcss.js:55:10)
    at Object.loader (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss-loader/dist/index.js:94:41)
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/webpack/lib/NormalModule.js:316:20
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.loader (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss-loader/dist/index.js:103:7)
 @ multi ./src/assets/style/tailwind-out.css ./src/bootstrap-grid.min.css ./src/assets/style/styles.scss styles[1]

Error: ./src/assets/style/tailwind-out.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
    at Processor.normalize (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:168:15)
    at new Processor (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/processor.js:52:25)
    at postcss (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss/lib/postcss.js:55:10)
    at Object.loader (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss-loader/dist/index.js:94:41)
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/webpack/lib/NormalModule.js:316:20
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.loader (/Users/miquel/AngularProjects/mit-evida/frontend/web/node_modules/postcss-loader/dist/index.js:103:7)
 @ multi ./src/assets/style/tailwind-out.css ./src/bootstrap-grid.min.css ./src/assets/style/styles.scss styles[0]

Error: ./src/assets/style/styles.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin

🌍 Your Environment

Angular Version:



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 11.1.0
Node: 14.15.0
OS: darwin x64

Angular: 11.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1101.0
@angular-devkit/build-angular   0.1101.0
@angular-devkit/core            11.1.0
@angular-devkit/schematics      11.1.0
@schematics/angular             11.1.0
@schematics/update              0.1101.0
rxjs                            6.6.3
typescript                      4.0.5

Anything else relevant?
Nothing else, can't build the app

@jerkovicl
Copy link

got the same error for HttpClient
image

@ghaschel
Copy link

I solved this by running:
rm -rf node_modules && npm cache clear --force && npm install

@petebacondarwin
Copy link
Contributor

Yes, please try removing node_modules and reinstalling.

@jerkovicl
Copy link

@petebacondarwin i did that still same error HttpClient is not defined

@acalvo
Copy link
Contributor

acalvo commented Jan 21, 2021

I'm having the same problem as OP, and neither npm ci nor rm -rf node_modules && npm cache clear --force && npm install solved it 😬

@petebacondarwin
Copy link
Contributor

Please can one of you provide a reproduction that we can debug?

@mrctrifork
Copy link
Author

I've removed node_modules, cleared npm's cache and reinstalled everything. Not fixed

@mrctrifork
Copy link
Author

I have a strong belief that is due to the PostCSS update. Before Angular 11 used PostCSS 7 and now I've seen on my package-lock.json plenty of references to PostCSS 8.

I am freaking out a little bit because this error:

imagen

Is a PostCSS error when referencing the main.ts file

@jerkovicl
Copy link

jerkovicl commented Jan 21, 2021

@mrctrifork if you do npm i postcss -D that error will be gone atleast in my case but HttpClient is still not defined

@mrctrifork
Copy link
Author

I confirm that running npm i postcss -D makes the error about PostCSS go away.
I have no injection errors in regards of the HttpClient.

@jerkovicl
Copy link

@petebacondarwin where can i send code for you to reproduce ?

@petebacondarwin
Copy link
Contributor

@jerkovicl - I have emailed you at your protonmail account.

@jerkovicl
Copy link

jerkovicl commented Jan 21, 2021

@petebacondarwin yeah i sent app code to you, did you receive it?

@leonelvsc
Copy link

leonelvsc commented Jan 21, 2021

Same here, did you run tests before release ?, how can an error like this reach a release

``` Error: (webpack)-dev-server/client?http://0.0.0.0:0&sockPath=/sockjs-node Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): NonErrorEmittedError: (Emitted value instead of an instance of Error) Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): Error: [object Object] is not a PostCSS plugin at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15) at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25) at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10) at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41) at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:313:13 at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11 at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18 at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/@ngtools/webpack/src/ivy/loader.js:57:9 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5)

Error: ./src/main.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:313:13
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/@ngtools/webpack/src/ivy/loader.js:57:9
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Error: ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:313:13
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/@ngtools/webpack/src/ivy/loader.js:57:9
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Error: ./src/styles.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/text-security/text-security.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/text-security/text-security-circle.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/swiper/swiper-bundle.min.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/@clr/icons/clr-icons.min.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/@clr/ui/clr-ui.min.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/flatpickr/dist/flatpickr.min.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/select2/dist/css/select2.min.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/ag-grid-community/dist/styles/ag-grid.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

Error: ./node_modules/ag-grid-community/dist/styles/ag-theme-balham.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: [object Object] is not a PostCSS plugin
at Processor.normalize (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:168:15)
at new Processor (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/processor.js:52:25)
at postcss (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss/lib/postcss.js:55:10)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:94:41)
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/webpack/lib/NormalModule.js:316:20
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.loader (/home/naxs/Trabajo/NaxsCloud/NaxsCloudWeb/node_modules/postcss-loader/dist/index.js:103:7)

</details>

@petebacondarwin
Copy link
Contributor

OK so there are two issues here:

  1. PostCSS dependency - this can be worked around by installing it directly at the top level npm i postcss -D
  2. Missing HttpClient import - looking into this now.

@petebacondarwin
Copy link
Contributor

Transferring to the CLI project, since we think it is most likely a problem there.

@petebacondarwin petebacondarwin transferred this issue from angular/angular Jan 21, 2021
@petebacondarwin
Copy link
Contributor

In the reproduction from @jerkovicl the main.js has the following code:

ApiService.ɵfac = function ApiService_Factory(t) { return new (t || ApiService)(_angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵɵinject"](_angular_common_http__WEBPACK_IMPORTED_MODULE_3__["HttpClient"])); };
ApiService.ɵprov = _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵɵdefineInjectable"]({ token: ApiService, factory: ApiService.ɵfac });
ApiService = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_ngneat_until_destroy__WEBPACK_IMPORTED_MODULE_1__["UntilDestroy"])({ checkProperties: true }),
    Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [HttpClient])
], ApiService);

You can note that there is a bare HttpClient identifier, which has no definition. Earlier on you see _angular_common_http__WEBPACK_IMPORTED_MODULE_3__["HttpClient"], which does work.

Looking at the output of the Angular compiler (before webpack) we see:

ApiService.ɵfac = function ApiService_Factory(t) { return new (t || ApiService)(i0.ɵɵinject(i1.HttpClient)); };
ApiService.ɵprov = i0.ɵɵdefineInjectable({ token: ApiService, factory: ApiService.ɵfac });
ApiService = __decorate([
    UntilDestroy({ checkProperties: true }),
    __metadata("design:paramtypes", [HttpClient])
], ApiService);
export { ApiService };
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ApiService, [{
        type: Injectable
    }], function () { return [{ type: i1.HttpClient }]; }, null); })();

Here you can see that there are i1.HttpClient references, which are the ones that get converted to the webpack imports.
But the __decorate() handler contains the bare HttpClient, which is what is undefined later on.

@petebacondarwin
Copy link
Contributor

petebacondarwin commented Jan 21, 2021

Update on the missing HttpClient import... This code that is problematic is being generated by TypeScript because of the tsconfig setting: "emitDecoratorMetadata": true,. Specifically this line:

__metadata("design:paramtypes", [HttpClient])

Setting this to false avoids generating this code, which is redundant in almost all cases anyway, and fixes the problem.

The only time when this setting needs to be true is if your application queries the metadata at runtime, which is fairly rare these days and if you are doing so then you probably know what you are doing.

That being said, we should probably work out why this import is being dropped...

@chunghha
Copy link

chunghha commented Jan 21, 2021

My refrenceError with angular-cli 11.1.0 is with Observable like as
@select('controls') readonly controls$: Observable<RegistrationCompControl>;
Keeping @angular 11.1.0 and downgrading of the cli to 11.0.7 resolved my problem for now.

EDIT: it's difference referenceError (Uncaught ReferenceError: OverlayContainer is not defined) but at least reproduce an error with this public repo, https://github.com/chunghha/docker-ng-cli/tree/develop, when you use the cli 11.1.0 but not with the cli 11.0.7.

@JoostK
Copy link
Member

JoostK commented Jan 21, 2021

I can reproduce the issues reference errors; disabling the new Ivy integration in the CLI does not show the same issue so there appears to be some bug there. A workaround could be to set the environment variable NG_BUILD_IVY_LEGACY=1 which deactivates the new Ivy plugin.

@JoostK
Copy link
Member

JoostK commented Jan 21, 2021

Good news for the HttpClient reference errors (and other reference errors): the root cause has already been found and is being addressed in #19841

@clydin
Copy link
Member

clydin commented Jan 22, 2021

The postcss errors have been traced to an npm package hoisting inconsistency which causes the wrong version of postcss to be used. From initial tests, it does not appear that yarn is affected. However, a fix is currently pending for the CLI (#19847) that will force the postcss-loader package (using a recently released new option) to use the correct version of postcss even in these cases.

In regards to the reference errors (fix pending as well: #19841), the emitDecoratorMetadata option is responsible for the initial creation of the code that is being subsequently broken. This TypeScript configuration option is no longer required by Angular (8.0.4+) and newly created projects no longer contain the option. Unless a third-party library or application code specifically requires the option, it can be safely removed. The need for this option is generally uncommon. Also of note is that the option generates code (more details) that has the potential to cause runtime errors with certain source code constructs.
However, for the cases where the option is required, a fix will be in the next patch release.

dgp1130 pushed a commit that referenced this issue Jan 22, 2021
…r package

`postcss-loader` version 4.2.0 added an `implementation` option. Using the using will ensure that the correct postcss version is used.

More info: webpack-contrib/postcss-loader@deac978

Fixes #19839
dgp1130 pushed a commit that referenced this issue Jan 22, 2021
…r package

`postcss-loader` version 4.2.0 added an `implementation` option. Using the using will ensure that the correct postcss version is used.

More info: webpack-contrib/postcss-loader@deac978

Fixes #19839

(cherry picked from commit 5711e69)
@dgp1130
Copy link
Collaborator

dgp1130 commented Jan 22, 2021

Just published v11.1.1 which should contain the necessary fixes for this issue. Please update to that version.

@markosiilak
Copy link

I solved this by running:
rm -rf node_modules && npm cache clear --force && npm install

Works like a Magic :)

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.