简体   繁体   English

将 NG-Zorro 从 V8 升级到 V9 给出:“Class extends value undefined is not a constructor or null”

[英]Upgrading NG-Zorro from V8 to V9 gives: “Class extends value undefined is not a constructor or null”

After running ng update ng-zorro-antd we get:运行ng update ng-zorro-antd ,我们得到:

[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.这也发生在一个全新的 Angular 8 项目中。 The upgrade to Angular 9 works fine but only the NG-Zorro update fails.升级到 Angular 9 工作正常,但只有 NG-Zorro 更新失败。

These are the contents of the calendar-input-rule.js file from the error:这些是来自错误的calendar-input-rule.js文件的内容:

"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?我看到有人说这可能是由于循环依赖,但应用程序运行正常,所以错误可能来自 NG-Zorro 的导入? Are there any workarounds this?这有什么解决方法吗?

Had the same error, after deleting node_modules and re-install everything is was gone.有同样的错误,删除 node_modules 并重新安装后一切都消失了。

I've posted this issue on their Github repo and they provided a workaround for it.我已经在他们的 Github repo上发布了这个问题,他们提供了一个解决方法。 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:我们所要做的就是安装旧版本的@angular/cdk (即使我们不直接使用它),直到他们发布补丁:

npm i @angular/cdk@9.2.1 --save

We removed @angular/cdk from package.json after the update.更新后,我们从 package.json 中删除了@angular/cdk I don't know if it will affect something in the future.不知道以后会不会有什么影响。 So far so good到目前为止,一切都很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从组件渲染 ng-zorro 标签 - Render ng-zorro tags from component ng upgrade命令无法将cli从v7升级到v8 - ng upgrade command fails for upgrading cli from v7 to v8 引入 stylelint-config-standard-scss 时,stylelint 给出错误“类扩展值未定义不是构造函数或 null” - stylelint gives error "Class extends value undefined is not a constructor or null" when introducing stylelint-config-standard-scss 空组件 (ng-zorro) - Empty component (ng-zorro) 可观察(角度)从 REST API 填充树(NG-ZORRO) - Observable (Angular) to populate Tree (NG-ZORRO) from REST API Angular 11.0.5 生产版本 - Class 扩展值未定义不是构造函数或 null - Angular 11.0.5 production build - Class extends value undefined is not a constructor or null 未捕获的类型错误:Class 扩展值未定义不是构造函数或 null - Uncaught TypeError: Class extends value undefined is not a constructor or null 将我的Angular应用程序从v7升级到v8 ng后,serve不再能够找到启动它的项目 - After upgrading my Angular app from v7 to v8 ng serve is no longer able to find the project to start it up Angular App 从 V8 升级到 V9 后无法编译 - Angular App cannot compile after update from V8 to V9 将 Angular 从 v8 更新到 v9 并启用 ivy 为 true 后,组件在开始时未加载 - After updating Angular from v8 to v9 and enabling ivy to true, component is not loading at beginning
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM