【问题标题】:Angular-cli component generator do not work inside NativesctiptAngular-cli 组件生成器在 Nativesctipt 中不起作用
【发布时间】:2020-07-23 00:18:51
【问题描述】:

我正在努力学习 AngularNativescript

所以,我在我的 Windows 10 机器上安装了 angular-clinativescript

Angular 本身可以正常工作,但是当我想在 nativescript 项目中生成组件时,出现以下错误:

经过几次研究,我从THIS SOURCE安装了@nativescript/schematics

npm i -g @angular/cli

npm i -g @nativescript/schematics “使用 -D 进行测试”

然后我有这个错误:

你知道我的问题是什么以及如何解决这个问题吗?

提前致谢

【问题讨论】:

    标签: angular nativescript angular2-nativescript


    【解决方案1】:

    我不知道为什么有人给我-1

    仍然需要一些额外的命令-for me on windows 10 and tested on mac- 可以使用:

    ng g c some-component

    在 nativescript-angular 项目中。

    这些步骤解决了我的问题:

    1. tns 创建 angularProject

    2. npm i -D @nativescript/schematics

    3. npm i @angular-devkit/schematics @angular-devkit/core @schematics/angular

    然后您可以简单地使用:ng g c some-component

    当我写这个答案时,我的 tns version6.8.0 而我的 angular-cli version10.0.4

    【讨论】:

    • 仍然给我The generate command requires to be run in an Angular project, but a project definition could not be found.
    【解决方案2】:

    npm i -D @angular/cli @nativescript/schematics

    (使它们都成为开发依赖项)

    然后看这里:https://github.com/NativeScript/nativescript-schematics/issues/241

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-07
      • 1970-01-01
      • 2018-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多