【问题标题】:Cannot install formly "Cannot read property 'kind' of undefined"无法正式安装“无法读取未定义的属性‘种类’”
【发布时间】:2021-04-29 20:01:56
【问题描述】:

这个问题可能看起来很愚蠢,但就像两周前一样,我在安装它时没有任何问题。 现在看起来像这样:

ng 添加@ngx-formly/schematics --ui-theme=material

我尝试在材料和 cdk 模块之后/之前安装它,但结果是一样的。 我还尝试安装所有单独的正式模块(基于我之前创建的项目),我收到此错误:

The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.

我也尝试删除节点模块和 yarn.lock 并重新初始化它,但它仍然不起作用。 而且,当我创建表单时,它也不会显示。 我还尝试使用 yarn add 安装它... 或-ui-theme=bootstrap,但结果是一样的。 在安装之前也尝试过 ng 服务(在堆栈上的某处读取),但它也不起作用。

我听说 node v.15.6.0 有一些问题,但我不确定是不是这样。 这也是我的版本:

yarn 版本是 1.22.5

更新: 我尝试使用 yarn upgrade --latest 升级所有软件包,然后再次正式安装。 之后:

 ng add @ngx-formly/schematics --ui-theme=material

我明白了:

An unhandled exception occurred: Cannot find module '@schematics/angular/utility/config'
Require stack:
- /home/wiktor/angular-material-template/node_modules/@ngx-formly/schematics/utils/ast.js
- /home/wiktor/angular-material-template/node_modules/@ngx-formly/schematics/src/ng-add/index.js
- /home/wiktor/angular-material-template/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /home/wiktor/angular-material-template/node_modules/@angular-devkit/schematics/tools/index.js
- /home/wiktor/angular-material-template/node_modules/@angular/cli/utilities/json-schema.js
- /home/wiktor/angular-material-template/node_modules/@angular/cli/models/command-runner.js
- /home/wiktor/angular-material-template/node_modules/@angular/cli/lib/cli/index.js
- /usr/lib/node_modules/@angular/cli/lib/init.js
- /usr/lib/node_modules/@angular/cli/bin/ng
See "/tmp/ng-rRKl9j/angular-errors.log" for further details.

【问题讨论】:

    标签: node.js angular node-modules yarnpkg angular-formly


    【解决方案1】:

    好的,我找到了解决方案。我不得不将角度示意图降级到以前的版本(为了安全,我降级了两个版本):

    npm uninstall @schematics/angular
    npm install @schematics/angular@9.1.0
    

    所以正式的原理图与 Angular 11 原理图不兼容。

    【讨论】:

    • 这适用于我使用 Angular 11 并尝试运行“ng add ngx-bootstrap”的相同问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-18
    • 2020-01-13
    • 2023-01-23
    • 2018-11-22
    • 2017-08-16
    相关资源
    最近更新 更多