首页 > 解决方案 > “ng g module”在 Angular 8 的模块内生成了一些奇怪的代码

问题描述

我正在执行命令:

   ng g module componentes/top-bar --routing  

我查看了 top-bar.module.ts 里面有这样的狗屎:

    {
  "_from": "@types/webpack-sources@^0.1.5",
  "_id": "@types/webpack-sources@0.1.5",
  "_inBundle": false,
  "_integrity": "sha512-zfvjpp7jiafSmrzJ2/i3LqOyTYTuJ7u1KOXlKgDlvsj9Rr0x7ZiYu5lZbXwobL7lmsRNtPXlBfmaUD8eU2Hu8w==",
  "_location": "/@types/webpack-sources",
  "_phantomChildren": 

在 top-bar-routing.module.ts 中有一些不需要的东西。

这开始突然发生了。我已经在同一个应用程序中生成了模块,我没有改变它之前工作的任何东西并且工作正常。

标签: angularangular-cliangular8

解决方案


我可以在网上搜索解决方案,但我采取了有保证的方式。我生成了一个新项目,现在我将把我所有的代码传递给新项目,有趣的东西!半天没了。昨天我用“ng new”输了半天。这个错误同样奇怪。这将是一个“Angular周”。


推荐阅读