运行'ng generate component'时,本机脚本错误'无法读取未定义的属性'种类' [英] Nativescript error 'Cannot read property 'kind' of undefined' when run 'ng generate component'
本文介绍了运行'ng generate component'时,本机脚本错误'无法读取未定义的属性'种类'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法将新组件添加到我的Nativescript项目中,当我执行 ng生成组件常见问题解答
时,它会返回错误:
I cannot add a new component to my Nativescript project, when I execute ng generate component faqs
it returns the error:
Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'kind' of undefined
或者如果我像 ng generate component
一样运行它,它会问我组件名称
or if I run it like ng generate component
it asks me the components name
? What name would you like to use for the component? faqs
并返回
Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'match' of undefined
我正在使用:
Nativescript 7.0.10
Angular CLI: 10.1.4
Node: 12.18.4
OS: win32 x64
Angular: 10.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1001.4
@angular-devkit/core 10.0.8
@angular-devkit/schematics 10.1.4
@ngtools/webpack 10.1.4
@schematics/angular 10.1.4
@schematics/update 0.1001.4
rxjs 6.6.3
typescript 3.9.7
然后我就跑:
tns create HelloWorld
npm i --save-dev @angular/cli
npm install --save-dev @nativescript/schematics
npm install --save-dev @schematics/angular
推荐答案
根据 https://github.com/NativeScript/nativescript-schematics/issues/302 解决方案/解决方法是将打字稿更新为版本4,即运行
According to https://github.com/NativeScript/nativescript-schematics/issues/302 the solution/workaround is to update typescript to version 4, i.e. run
npm install --save-dev typescript@4
我测试了以下步骤,并且似乎可以正常工作:
I tested the following steps, and it seems to work:
npm i -g @nativescript/schematics
ng new -c=@nativescript/schematics my-project --shared
cd my-project
npm install --save-dev typescript@4
ng g component bla
这篇关于运行'ng generate component'时,本机脚本错误'无法读取未定义的属性'种类'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文