Primeng: Prime NG not working with angular 9

Created on 25 Jul 2020  Â·  4Comments  Â·  Source: primefaces/primeng

While doing ng serve, the following error throwing.

ERROR in Unexpected directive 'InputTextarea in D:/serverless/truehyre/frontend/node_modules/primeng/inputtextarea/primeng-inputtextarea.d.ts' imported by the module 'AppModule in D:/serverless/truehyre/frontend/src/app/app.module.ts'. Please add a @NgModule annotation.

Same issue with either ivy enabled or disabled.

_                      _                 ____ _     ___ 
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ â–³ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/

Angular CLI: 9.1.11
Node: 12.10.0
OS: win32 x64

Angular: 9.1.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: No

Package Version

@angular-devkit/architect 0.901.11
@angular-devkit/build-angular 0.901.11
@angular-devkit/build-optimizer 0.901.11
@angular-devkit/build-webpack 0.901.11
@angular-devkit/core 9.1.11
@angular-devkit/schematics 9.1.11
@angular/cdk 10.1.0
@angular/cli 9.1.11
@ngtools/webpack 9.1.11
@schematics/angular 9.1.11
@schematics/update 0.901.11
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0

Most helpful comment

Primeng works fine with angular 9 & 10.
Try to delete node_modules and package-lock.json, and install again (npm install).
Or maybe you are not using primeng properly. Check this page: https://www.primefaces.org/primeng/showcase/#/setup

All 4 comments

Error from browser

Failed to compile.

node_modules/primeng/inputtextarea/inputtextarea.d.ts:5:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (primeng) which declares InputTextarea has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

5 export declare class InputTextarea implements DoCheck {
~~~~~

Primeng works fine with angular 9 & 10.
Try to delete node_modules and package-lock.json, and install again (npm install).
Or maybe you are not using primeng properly. Check this page: https://www.primefaces.org/primeng/showcase/#/setup

This is not a valid issue ticket, there seems to be an issue on your side.

This is not a valid issue ticket, there seems to be an issue on your side.

For some reason, the components are rendered correctly in the AppComponent with this syntax

<button pButton label="Test Me"></button>

But I need to add the classes when used in a Module

<button pButton label="Test Me" class="p-button p-component"></button>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philly-vanilly picture philly-vanilly  Â·  3Comments

watalberto picture watalberto  Â·  3Comments

pchristou picture pchristou  Â·  3Comments

mitosandov picture mitosandov  Â·  3Comments

gatapia picture gatapia  Â·  3Comments