Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

node.js - Cannot install formly "Cannot read property 'kind' of undefined"

This question may looks dumb, but like two weeks ago, I had no problems with installing it. Now it looks like that: Installing formly

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

I tried install it after/before material and cdk modules, but the result is the same. I also tried to install all separate formly modules( on the base of projects that I created previously) and I get this error:

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.

I also tried to delete node modules and yarn.lock and init it again, but still it doesn't works. And also when I create form it just doesn't show. I also tried to install it with yarn add ... or -ui-theme=bootstrap, but the result is the same. Also tried to ng serve, before installing it(read it somewhere on stack), but it also doesn't work.

I have heard that there are some problems with node v.15.6.0, but I'm not sure if it's that. Here's also my versions:

Angular cli version

and yarn version is 1.22.5

Update: I tried to upgrade all the packages with yarn upgrade --latest, then install formly again. And after:

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

I get that:

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.
question from:https://stackoverflow.com/questions/65894531/cannot-install-formly-cannot-read-property-kind-of-undefined

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Ok, I found the solution. I had to downgrade angular schematics to previous version( for safety I downgrade two versions):

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

So formly schematics is not compatible with angular 11 schematics.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...