0

After running ng update ng-zorro-antd we get:

[error] TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:\Users\<user name>\Desktop\Work\<project name>\node_modules\ng-zorro-antd\schematics\ng-update\upgrade-rules\checks\calendar-input-rule.js:4:49)

This also happens in a brand new Angular 8 project. The upgrade to Angular 9 works fine but only the NG-Zorro update fails.

These are the contents of the calendar-input-rule.js file from the error:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular/cdk/schematics");
class CalendarTemplateRule extends schematics_1.MigrationRule {
    constructor() {
        super(...arguments);
        this.ruleEnabled = this.targetVersion === schematics_1.TargetVersion.V9;
    }
    visitTemplate(template) {
        schematics_1.findInputsOnElementWithTag(template.content, 'nzCard', ['nz-calendar'])
            .forEach(offset => {
            this.failures.push({
                filePath: template.filePath,
                position: template.getCharacterAndLineOfPosition(offset),
                message: `Found deprecated input "nzCard" component. Use "nzFullscreen" to instead please.`
            });
        });
    }
}
exports.CalendarTemplateRule = CalendarTemplateRule;
//# sourceMappingURL=calendar-input-rule.js.map

I saw people saying that it might be due to circular dependencies but the app is working fine, so the error might be from the NG-Zorro's imports? Are there any workarounds this?

Ionel Lupu
  • 2,695
  • 6
  • 29
  • 53

2 Answers2

0

Had the same error, after deleting node_modules and re-install everything is was gone.

Alex Boner
  • 51
  • 3
  • I did that and I still get the error. Did you get the exact same error for the calendar rule? Also, what was the version of ng-zorro in package.json before re-install? Are you sure you didn't install ng-zorro v9 without running the migration rules? – Ionel Lupu May 05 '20 at 06:49
  • The error was the same but not from calendar rule as I remember. Version after upgrade was 9.1.0 – Alex Boner May 05 '20 at 08:17
  • I've made a github issue for this https://github.com/NG-ZORRO/ng-zorro-antd/issues/5197 – Ionel Lupu May 05 '20 at 08:51
0

I've posted this issue on their Github repo and they provided a workaround for it. All we had to do is to install an older version of @angular/cdk (even if we don't use it directly) until they release a patch:

npm i @angular/cdk@9.2.1 --save

We removed @angular/cdk from package.json after the update. I don't know if it will affect something in the future. So far so good

Ionel Lupu
  • 2,695
  • 6
  • 29
  • 53