NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.87k stars 3.94k forks source link

9.0.0-beta.2 Fails to compile #4917

Closed aahmyu closed 4 years ago

aahmyu commented 4 years ago

Hello, Im trying the new 9 beta 2 but i can't get it to compile with ngcc, i'm getting this error:

`Error: Error on worker #5: Error: Failed to compile entry-point ng-zorro-antd/empty (es2015 as esm2015) due to compilation errors: node_modules/ng-zorro-antd/core/outlet/outlet.module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of NzEmptyModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-zorro-antd/core/outlet) which declares NzOutletModule 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.

8 export declare class NzOutletModule {



    at ClusterWorker.compile (/home/mmmm/projects/private/zorro/node_modules/@angular/compiler-cli/ngcc/src/main.js:176:27)
    at Worker.<anonymous> (/home/mmmm/projects/private/zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:44:42)
    at Worker.emit (events.js:311:20)
    at process.<anonymous> (internal/cluster/worker.js:32:12)
    at process.emit (events.js:311:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
    at ClusterMaster.onWorkerMessage (/home/mmmm/projects/private/zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:165:27)
    at /home/mmmm/projects/private/zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:49:95
    at ClusterMaster.<anonymous> (/home/mmmm/projects/private/zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:245:57)
    at step (/home/mmmm/projects/private/zorro/node_modules/tslib/tslib.js:136:27)
    at Object.next (/home/mmmm/projects/private/zorro/node_modules/tslib/tslib.js:117:57)
    at /home/mmmm/projects/private/zorro/node_modules/tslib/tslib.js:110:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/home/mmmm/projects/private/zorro/node_modules/tslib/tslib.js:106:16)
    at EventEmitter.<anonymous> (/home/mmmm/projects/private/zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:239:32)
    at EventEmitter.emit (events.js:311:20)
Compiling @ngrx/effects : es2015 as esm2015`
vthinkxie commented 4 years ago

Hi @aahmyu thanks for your feedback, could you provide a repro repo? it works fine in our test

aahmyu commented 4 years ago

Hello, I created a new project and didn't encounter the issue. So I guess the problem is on my end.

boskiv commented 4 years ago

it causes by updating ng from 9.0.1 to 9.0.7

➜  nx-zorro git:(master) ng update
Your global Angular CLI version (9.0.7) is greater than your local
version (9.0.1). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via yarn.
Installed packages for tooling via yarn.
Using package manager: 'yarn'
Collecting installed dependencies...
Found 33 dependencies.
    We analyzed your package.json, there are some packages to update:

      Name                               Version                  Command to update
     --------------------------------------------------------------------------------
      @angular/cli                       9.0.1 -> 9.0.7           ng update @angular/cli
      @angular/core                      9.0.0 -> 9.0.7           ng update @angular/core
➜  nx-zorro git:(master) ng update @angular/core
Your global Angular CLI version (9.0.7) is greater than your local
version (9.0.1). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via yarn.
Installed packages for tooling via yarn.
Using package manager: 'yarn'
Collecting installed dependencies...
Found 33 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular/core" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/compiler-cli" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/forms" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/animations" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/platform-browser" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/compiler" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/platform-browser-dynamic" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/common" has a missing peer dependency of "tslib" @ "^1.10.0".
                  Package "@angular/router" has a missing peer dependency of "tslib" @ "^1.10.0".
    Updating package.json with dependency @angular/core @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/compiler-cli @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/language-service @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/forms @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/animations @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/platform-browser @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/compiler @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/common @ "9.0.7" (was "9.0.0")...
    Updating package.json with dependency @angular/router @ "9.0.7" (was "9.0.0")...
UPDATE package.json (2038 bytes)
⠇ Installing packages...warning " > @angular/animations@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/common@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/compiler@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/core@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/forms@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/platform-browser@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/platform-browser-dynamic@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/router@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning "@nrwl/angular > @nrwl/cypress > @cypress/webpack-preprocessor@4.1.3" has unmet peer dependency "webpack@^4.18.1".
warning "@nrwl/angular > @nrwl/cypress > @cypress/webpack-preprocessor > babel-loader@8.1.0" has unmet peer dependency "webpack@>=2".
warning " > ng-zorro-antd@9.0.0-beta.2" has unmet peer dependency "tslib@^1.10.0".
warning "ng-zorro-antd > @angular/cdk@9.1.3" has unmet peer dependency "tslib@^1.9.0".
warning "ng-zorro-antd > @ant-design/icons-angular@9.0.0" has unmet peer dependency "tslib@^1.10.0".
warning " > @angular/compiler-cli@9.0.7" has unmet peer dependency "tslib@^1.10.0".
warning " > codelyzer@5.0.1" has incorrect peer dependency "@angular/compiler@>=2.3.1 <9.0.0 || >8.0.0-beta <9.0.0".
warning " > codelyzer@5.0.1" has incorrect peer dependency "@angular/core@>=2.3.1 <9.0.0 || >8.0.0-beta <9.0.0".
warning " > codelyzer@5.0.1" has incorrect peer dependency "tslint@^5.0.0".
Compiling @angular/cdk/keycodes : es2015 as esm2015
Compiling @angular/animations : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/animations/browser : es2015 as esm2015
Compiling @angular/cdk/collections : es2015 as esm2015
Compiling @angular/cdk/observers : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling ng-zorro-antd/version : es2015 as esm2015
Compiling @angular/cdk/platform : es2015 as esm2015
Compiling @angular/cdk/accordion : es2015 as esm2015
Compiling @angular/cdk/bidi : es2015 as esm2015
Compiling @angular/cdk/portal : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/forms : es2015 as esm2015
Compiling ng-zorro-antd/i18n : es2015 as esm2015
Compiling @angular/cdk/a11y : es2015 as esm2015
Compiling @angular/cdk/scrolling : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Compiling @angular/cdk/layout : es2015 as esm2015
Compiling ng-zorro-antd/spin : es2015 as esm2015
Compiling ng-zorro-antd/grid : es2015 as esm2015
Compiling ng-zorro-antd/affix : es2015 as esm2015
Compiling @angular/platform-browser/animations : es2015 as esm2015
Compiling @angular/cdk/overlay : es2015 as esm2015
Compiling ng-zorro-antd/empty : es2015 as esm2015
Compiling @ant-design/icons-angular : es2015 as esm2015
Error: Error on worker #1: Error: Failed to compile entry-point ng-zorro-antd/empty (es2015 as esm2015) due to compilation errors:
node_modules/ng-zorro-antd/core/outlet/outlet.module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of NzEmptyModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-zorro-antd/core/outlet) which declares NzOutletModule 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.

8 export declare class NzOutletModule {
                       ~~~~~~~~~~~~~~

    at ClusterWorker.compile (/Users/i_skiridomov/Projects/nx-zorro/node_modules/@angular/compiler-cli/ngcc/src/main.js:178:27)
    at Worker.<anonymous> (/Users/i_skiridomov/Projects/nx-zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:44:42)
    at Worker.emit (events.js:311:20)
    at process.<anonymous> (internal/cluster/worker.js:32:12)
    at process.emit (events.js:311:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
    at ClusterMaster.onWorkerMessage (/Users/i_skiridomov/Projects/nx-zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:165:27)
    at /Users/i_skiridomov/Projects/nx-zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:49:95
    at ClusterMaster.<anonymous> (/Users/i_skiridomov/Projects/nx-zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:245:57)
    at step (/Users/i_skiridomov/Projects/nx-zorro/node_modules/tslib/tslib.js:139:27)
    at Object.next (/Users/i_skiridomov/Projects/nx-zorro/node_modules/tslib/tslib.js:120:57)
    at /Users/i_skiridomov/Projects/nx-zorro/node_modules/tslib/tslib.js:113:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/i_skiridomov/Projects/nx-zorro/node_modules/tslib/tslib.js:109:16)
    at EventEmitter.<anonymous> (/Users/i_skiridomov/Projects/nx-zorro/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:239:32)
    at EventEmitter.emit (events.js:311:20)
Compiling ng-zorro-antd/radio : es2015 as esm2015
Compiling ng-zorro-antd/checkbox : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling @angular/common/testing : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling ng-zorro-antd/tooltip : es2015 as esm2015
✖ Package install failed, see above.
✖ Migration failed. See above for further details.
boskiv commented 4 years ago

Here is a repo with problem: https://github.com/boskiv/nx-zorro Before updating (on 9.0.1) it was compiled without an error.

krokofant commented 4 years ago

Does the beta.1 fail in the same way? I had a bunch of issues with that version but assumed it was all on my end.

boskiv commented 4 years ago

No, the compilation is a success when I fix with beta1

➜  nx-zorro git:(master) ✗ yarn list | grep zorro
├─ ng-zorro-antd@9.0.0-beta.1
➜  nx-zorro git:(master) ✗ yarn
yarn install v1.22.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > @nrwl/workspace@9.1.2" has incorrect peer dependency "prettier@^1.19.1".
warning " > codelyzer@5.2.1" has incorrect peer dependency "tslint@^5.0.0".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
$ ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points
Compiling @angular/cdk/keycodes : es2015 as esm2015
Compiling @angular/animations : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/animations/browser : es2015 as esm2015
Compiling @angular/cdk/collections : es2015 as esm2015
Compiling @angular/cdk/observers : es2015 as esm2015
Compiling @angular/cdk/platform : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling @angular/cdk/accordion : es2015 as esm2015
Compiling @angular/common/testing : es2015 as esm2015
Compiling @angular/cdk/portal : es2015 as esm2015
Compiling @angular/cdk/bidi : es2015 as esm2015
Compiling @angular/cdk/a11y : es2015 as esm2015
Compiling @angular/animations/browser/testing : es2015 as esm2015
Compiling @angular/cdk/clipboard : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/cdk/layout : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Compiling @angular/cdk/stepper : es2015 as esm2015
Compiling @angular/cdk/scrolling : es2015 as esm2015
Compiling @angular/cdk/table : es2015 as esm2015
Compiling @angular/cdk/text-field : es2015 as esm2015
Compiling @angular/cdk/tree : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling @angular/common/http/testing : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling @ant-design/icons-angular : es2015 as esm2015
Compiling @angular/forms : es2015 as esm2015
Compiling @angular/platform-browser/animations : es2015 as esm2015
Compiling @angular/cdk/drag-drop : es2015 as esm2015
Compiling @angular/router/testing : es2015 as esm2015
Compiling @angular/cdk/overlay : es2015 as esm2015
Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015
Compiling @ant-design/icons-angular/icons : es2015 as esm2015
✨  Done in 36.04s.

But no compilation of ng-zorro-antd/empty (es2015 as esm2015) as you can see in list above

vthinkxie commented 4 years ago

Hi all, it seems that the bug is caused by @angular/compiler, we will keep tracking until it is resolved ref https://github.com/angular/angular/issues/36185

ThibaudAV commented 4 years ago

Same problem with beta.3 and angular 9.1 but on many more components ng-zorro-antd/*

A small extract:

Error: Failed to compile entry-point ng-zorro-antd/empty (es2015 as esm2015) due to compilation errors:
node_modules/ng-zorro-antd/core/outlet/outlet.module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of NzEmptyModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-zorro-antd/core/outlet) which declares NzOutletModule 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.

8 export declare class NzOutletModule {
                       ~~~~~~~~~~~~~~

Compiling @angular/material/form-field : es2015 as esm2015
Compiling @angular/cdk/layout : es2015 as esm2015
Compiling @angular/material/button : es2015 as esm2015
Compiling ng-zorro-antd/icon : es2015 as esm2015
Compiling ng-zorro-antd/tooltip : es2015 as esm2015
Error: Failed to compile entry-point ng-zorro-antd/tooltip (es2015 as esm2015) due to compilation errors:
node_modules/ng-zorro-antd/core/outlet/outlet.module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of NzToolTipModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-zorro-antd/core/outlet) which declares NzOutletModule 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.

8 export declare class NzOutletModule {
                       ~~~~~~~~~~~~~~
node_modules/ng-zorro-antd/core/overlay/nz-overlay.module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of NzToolTipModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-zorro-antd/core/overlay) which declares NzOverlayModule 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.

8 export declare class NzOverlayModule {
                       ~~~~~~~~~~~~~~~
node_modules/ng-zorro-antd/core/no-animation/nz-no-animation.module.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of NzToolTipModule, but could not be resolved to an NgModule class.
vthinkxie commented 4 years ago

Hi @ThibaudAV have you try to remove the node_modules and package-lock.json I have tried with ng-zorro-antd 9.0.0-beta.3 and @angular/core 9.1.0 everything seems works fine

boskiv commented 4 years ago

This does not help for me here https://github.com/boskiv/nx-zorro (this is a project generated with nrwl) This is a plain angular project with zorro added. There is also an compilation issue https://github.com/boskiv/plain-zorro

vthinkxie commented 4 years ago

track https://github.com/angular/angular/pull/36305

3Shain commented 4 years ago

I've confirmed that it works fine with Angular 9.1.1 & beta 3 . Remove node_modules first.

boskiv commented 4 years ago

You can close this issue

mubeenzepto commented 3 years ago

Build at: 2021-01-14T13:40:09.084Z - Hash: 9aa2e84ab3de68942ad8 - Time: 17750ms

Error: The target entry-point "ng-zorro-antd/affix" has missing dependencies: