1

在有人将此标记为重复之前,我已经尝试了所有发布的解决方案,并且我去过 GitHub 问题,在 StackOverflow 中,没有一个解决方案对我有用。

每当我尝试以角度生成任何东西时,它都会给我这个错误。这在我安装时开始,@angular/pwa但不确定这是否完全是原因,因为我有一段时间没有在任何早期的应用程序中尝试过生成命令。我完全卸载了nodejs并重新安装了它,删除了所有的node_modules,包括全局的和本地的,所有这些都没有结果,请帮忙,因为我留下了复制组件和编辑它们,虽然不多,但感觉像是一项任务自己的。提前致谢。

编辑

这是我附加--debug标志时出现的错误

An error occured:
Cannot read property 'entries' of undefined
TypeError: Cannot read property 'entries' of undefined
    at new FilteredTree (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/@angular-devkit/schematics/src/tree/filtered.js:13:18)
    at /media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/@angular-devkit/schematics/src/rules/base.js:82:22
    at MergeMapSubscriber.input.pipe.operators_1.mergeMap.inputTree [as project] (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/@angular-devkit/schematics/src/rules/call.js:77:24)
    at MergeMapSubscriber._tryNext (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
    at MergeMapSubscriber._next (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
    at MergeMapSubscriber.Subscriber.next (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/rxjs/internal/Subscriber.js:68:18)
    at Observable._subscribe (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/rxjs/internal/observable/scalar.js:6:20)
    at Observable._trySubscribe (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/rxjs/internal/Observable.js:43:25)
    at Observable.subscribe (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/rxjs/internal/Observable.js:29:22)
    at MergeMapOperator.call (/media/hamisi/New Volume/Work Projects/diaspora-selfcare-portal/frontend/node_modules/rxjs/internal/operators/mergeMap.js:39:23)

这就是我跑步时得到的ng -v

Angular CLI: 6.2.1
Node: 10.10.0
OS: linux x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.7.5
@angular-devkit/schematics        0.6.8
@angular/cli                      6.2.1
@angular/pwa                      0.6.8
@ngtools/webpack                  6.1.5
@schematics/angular               0.6.8
@schematics/update                0.8.1
rxjs                              6.3.2
typescript                        2.7.2
webpack                           4.9.2
4

2 回答 2

2

您可以通过两种方式解决此问题,

(i) 从用户目录重新安装 NodeJS.Delete node_modules 文件夹并点击npm install

(ii) 尝试将@angular/pwa包更新到版本 ~0.7.5here

于 2018-09-15T14:03:59.993 回答
0

在尝试使用原理图生成某些东西时,我遇到了类似的问题。我尝试@schematics/angular使用以下方法显式安装和设置我的默认 cli 集合:

npm i @schematics/angular --save-dev
ng config cli.defaultCollection @schematics/angular

它对我不起作用。

所以相反,因为我已经在我的项目中使用了 ngrx,所以我选择了@ngrx/schematics作为我的默认值。

npm i @ngrx/schematics -D
ng config cli.defaultCollection @ngrx/schematics

这对我有用。

于 2019-11-11T13:16:42.507 回答