简体   繁体   English

ng add @nativescript/schematics 迁移尝试失败。 原因:“不支持:关键字“id”,使用“$id”作为模式 ID”

[英]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 和本机应用程序上的 DXUX 都低于标准,现在通过使用 Nx 并为代码共享创建共享库和为其他所有内容创建特定于平台的库,可以更轻松地解决这些问题。

暂无
暂无

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

相关问题 不支持:关键字“id”,使用“$id”作为模式 ID:TSLint(ng add @angular-eslint/schematics) - NOT SUPPORTED: keyword "id", use "$id" for schema ID : TSLint (ng add @angular-eslint/schematics) Angular 原理图异常:“不支持:关键字“id”,使用“$id”作为架构 ID” - Angular schematics exception: "NOT SUPPORTED: keyword "id", use "$id" for schema ID" 发生未处理的异常:不支持:关键字“id”,使用“$id”作为架构 ID - Angular 13 中的“ng add @ngrx/store” - An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID - "ng add @ngrx/store" in Angular 13 发生未处理的异常:不支持:关键字“id”,使用“$id”作为模式 ID - An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID 错误:不支持:关键字“id”,在 Angular13 升级后使用“$id”作为架构 ID - Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID following Angular13 upgrade 创建组件时,发生未处理的异常:不支持:关键字“id”,使用“$id”作为架构 ID - When creating component, An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID 在Nativescript中使用自动完成文本视图时如何保存ID - How to save id when I use Autocomplete Text View in Nativescript ng:键或ID为“ http://json-schema.org/draft-06/schema”的架构已存在 - ng: schema with key or id “http://json-schema.org/draft-06/schema” already exists 如何使用Nativescript从链接获取ID - How to get ID from link, using Nativescript 如何在ng-template中动态添加模板引用ID - How to add template reference id dynamically in ng-template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM