【问题标题】:global Angular CLI version (7.2.2) is greater than your local version全局 Angular CLI 版本 (7.2.2) 高于您的本地版本
【发布时间】:2020-01-14 04:46:51
【问题描述】:

我正在开发 Angular 2 应用程序,但在尝试使用 CLI 创建组件时出错。

命令

ng g c mycomponent

我已尝试通过执行以下操作重新安装 cli,但似乎并没有真正起作用

ng new my-project
cd my-project
ng g c my-component --m app

错误

Your global Angular CLI version (7.2.2) is greater than your local
version (6.0.8). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Could not find an NgModule. Use the skip-import option to skip importing in NgModule.

对 Visual Studio 代码进行版本检查

在 cmd 上进行 ng 版本检查

【问题讨论】:

    标签: angular6


    【解决方案1】:

    尝试删除整个项目,然后在将组件 cd 创建到您的应用程序文件夹时,然后键入以下内容。

    $ ng g c component name --module app
    

    它肯定会创建一个组件。

    【讨论】:

      猜你喜欢
      • 2018-06-27
      • 2022-12-08
      • 2019-01-14
      • 1970-01-01
      • 2018-11-22
      • 2017-11-15
      • 1970-01-01
      • 2017-07-06
      • 1970-01-01
      相关资源
      最近更新 更多