[英]ng add @nativescript/schematics migration attempt failing. Reason: "NOT SUPPORTED: keyword "id", use "$id" for schema ID"
I am trying to run "ng add @nativescript/schematics" to migrate my Angular app to Nativescript for mobile support.我正在尝试运行“ng add @nativescript/schematics”以将我的 Angular 应用程序迁移到 Nativescript 以获得移动支持。
When I run the command, not only does it not generate the.tns files that signify successful conversion, it prints this in the console:当我运行该命令时,它不仅没有生成表示转换成功的 .tns 文件,它还在控制台中打印:
√ Packages successfully installed.
NOT SUPPORTED: keyword "id", use "$id" for schema ID
It gives very little to go off of.它给 go 关的很少。 I have tried searching the @nativescript module in the node_modules folder and there is no "id" field to speak of.
我尝试在 node_modules 文件夹中搜索 @nativescript 模块,但没有“id”字段可言。
@nativescript/schematics
are deprecated: @nativescript/schematics
已弃用:
@nativescript/schematics have been deprecated, better alternatives for code-sharing in NativeScript can be explored in the docs https://docs.nativescript.org/code-sharing
@nativescript/schematics 已被弃用,可以在文档https://docs.nativescript.org/code-sharing中探索 NativeScript 中更好的代码共享替代方案
https://www.npmjs.com/package/@nativescript/schematics https://www.npmjs.com/package/@nativescript/schematics
The main way to develop angular web+nativescript projects now is using Nx.现在开发angular web+nativescript项目的主要方式是使用Nx。 The reason being that using the old schematics and having
.tns.ts
and .tns.html
files ended up very confusing and more often than not introduced a lot of anti-patterns on both NativeScript and web.原因是使用旧的原理图并拥有
.tns.ts
和.tns.html
文件最终会非常混乱,而且通常会在 NativeScript 和 web 上引入很多反模式。
So while seemed like a good idea at first, you always ended up with:所以虽然一开始看起来是个好主意,但你总是以:
my.component.ts
my.component.tns.ts
my.component.html
my.component.tns.html
my.module.ts
my.module.tns.ts
Essentially reusing 0 lines of code.本质上重用 0 行代码。 On top of that, the native application would also follow a "web" approach of nesting a lot of layouts, which are much heavier on native platforms than divs are on the web ( https://blog.nativescript.org/nativescript-angular-performance-tips-tricks/ ).
最重要的是,本机应用程序还将遵循嵌套大量布局的“Web”方法,这些布局在本机平台上比 web 上的 div 重得多( https://blog.nativescript.org/nativescript-angular -性能提示-技巧/ )。
In the end you ended up with subpar DX and UX on both web and native apps, which are now much easier to solve by using Nx and creating shared libraries for code sharing and platform-specific libraries for everything else.最后,您在 web 和本机应用程序上的 DX和UX 都低于标准,现在通过使用 Nx 并为代码共享创建共享库和为其他所有内容创建特定于平台的库,可以更轻松地解决这些问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.