【问题标题】:Angular-Cli 'ng g c my-new-component' Error: Could not find (undefined) and Could not find (undefined)Angular-Cli 'ng g c my-new-component' 错误:找不到(未定义)和找不到(未定义)
【发布时间】:2018-09-20 17:08:22
【问题描述】:

问题:

在我的 Angular 5+ 应用程序项目中,在我的一个子文件夹中,在我输入 ng g c my-component 推荐后,没有生成任何东西,而是弹出一些未知错误,有人知道这里发生了什么吗?我已经多次重新安装了 npm/angular@cli。

jocs@Jocs ~/r/s/a/pages (devReno)> ng g c my-new-component
Error: Could not find (undefined)
Could not find (undefined)
jocs@Jocs ~/r/s/a/pages (devReno) [1]> ng generate component my-new-component
Error: Could not find (undefined)
Could not find (undefined)
jocs@Jocs ~/r/s/a/pages (devReno) [1]>


开发环境:

操作系统:darwin x64(Mac 操作系统:10.13.4)

Angular CLI:1.7.4

节点:9.11.1

角度:5.2.9

【问题讨论】:

  • 有同样的问题。将 angular-cli 降级到 1.7.3 为我解决了问题。
  • 它没有帮助我
  • 约瑟夫,你的问题解决了吗?

标签: angular terminal command-line-interface angular-cli


【解决方案1】:

我遇到了这个问题,我不得不重新安装 Angular Cli。

我重新安装的方式是降级然后再升级回来。我想你也可以从 node_modules 中删除包,或者先删除 npm uninstall @angular/cli 然后 npm i @angular/cli@1.7.4

对我有用的方法是这样做:

如果我安装不同的版本,我的 npm 版本(6.0 版)将降级 angular cli $ npm i @angular/cli@1.7.3

然后我升级回 1.7.4 $ npm i @angular/cli@1.7.4

【讨论】:

    【解决方案2】:

    我的问题是根目录中有文件和节点目录。我删除它。

    rm -rf node_modules/
    rm package-lock.json
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-27
      • 2022-01-18
      • 1970-01-01
      • 2021-03-11
      • 1970-01-01
      • 2017-04-05
      • 2019-01-11
      • 1970-01-01
      相关资源
      最近更新 更多