简体   繁体   English

ng serve 后无法解析 NgxGalleryPreviewComponent 的所有参数

[英]Can't resolve all parameters for NgxGalleryPreviewComponent after ng serve

I recently updated my angular project from version 8 to 9 and have been experiencing the above mentioned issue.我最近将我的 angular 项目从版本 8 更新到了 9,并且遇到了上述问题。 My project makes use of ngx-gallery and after the update to angular 9, I updated all references to the deprecated Renderer service to Renderer2 inside ngx-gallery-helper.service.d.ts and ngx-gallery-preview.component.d.ts .我的项目使用了ngx-gallery ,在更新到 angular 9 之后,我将所有对已弃用的Renderer服务的引用更新到ngx-gallery-helper.service.d.tsngx-gallery-preview.component.d.ts Renderer2 ngx-gallery-preview.component.d.ts

My currently installed version of npx-gallery is the latest one (5.10.0).我当前安装的 npx npx-gallery版本是最新版本 (5.10.0)。 When I run ng serve the home page doesn't even load, I get the following error in the console:当我运行ng serve ,主页甚至没有加载,我在控制台中收到以下错误:

Uncaught Error: Can't resolve all parameters for NgxGalleryPreviewComponent: ([object Object], [object Object], [object Object], ?, [object Object]).
    at syntaxError (compiler.js:2281)
    at CompileMetadataResolver._getDependenciesMetadata (compiler.js:21063)
    at CompileMetadataResolver._getTypeMetadata (compiler.js:20958)
    at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (compiler.js:20573)
    at CompileMetadataResolver.loadDirectiveMetadata (compiler.js:20437)
    at compiler.js:26467
    at Array.forEach (<anonymous>)
    at compiler.js:26466
    at Array.forEach (<anonymous>)
    at JitCompiler._loadModules (compiler.js:26463)

Running ng --version inside my project root folder outputs the following:在我的项目根文件夹中运行ng --version输出以下内容:

Angular CLI: 9.0.1
Node: 12.8.0

Angular: 9.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.1
@angular-devkit/build-angular      0.900.1
@angular-devkit/build-optimizer    0.900.1
@angular-devkit/build-webpack      0.900.1
@angular-devkit/core               9.0.1
@angular-devkit/schematics         9.0.1
@angular/cli                       9.0.1
@angular/flex-layout               9.0.0-beta.29
@angular/material-moment-adapter   8.2.3
@ngtools/webpack                   9.0.1
@schematics/angular                9.0.1
@schematics/update                 0.900.1
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.41.2

What am I missing?我错过了什么? Your help would be greatly appreciated.您的帮助将不胜感激。 Thank you.谢谢你。

Files "ngx-gallery-helper.service.d.ts" and "ngx-gallery-preview.component.d.ts" are inside folder node_modules.文件“ngx-gallery-helper.service.d.ts”和“ngx-gallery-preview.component.d.ts”位于文件夹 node_modules 中。 Node_modules generated automatically with npm.使用 npm 自动生成的 Node_modules。 No changes inside folder 'node_modules' possible.文件夹“node_modules”内不可能发生任何变化。 It will be recreated with npm.它将使用 npm 重新创建。

Solution of bug must be not very hard.解决bug应该不是很难。 As usual.照常。 Change "Renderer" -> "Renderer2" and related items.更改“渲染器”->“渲染器2”和相关项目。 But really big problem - this gallery in repository and only author of ngx-gallery has got access.但真正的大问题 - 存储库中的这个画廊并且只有 ngx-gallery 的作者可以访问。

What can be done:可以做什么:

  • Trigger author of https://www.npmjs.com/package/ngx-gallery . https://www.npmjs.com/package/ngx-gallery 的触发器作者。 Ask him to fix bug and push fix into repository.请他修复错误并将修复程序推送到存储库中。
  • Move gallery from repository to local module and fix bug.将图库从存储库移动到本地模块并修复错误。 Before this better to try fix files "ngx-gallery-helper.service.d.ts" and "ngx-gallery-preview.component.d.ts" in "node_modules" by hands and look if problem was gone.在此之前最好尝试手动修复“node_modules”中的“ngx-gallery-helper.service.d.ts”和“ngx-gallery-preview.component.d.ts”文件,并查看问题是否消失。 Just for test.只是为了测试。
  • Rewrite "ngx-gallery-helper.service.d.ts" and "ngx-gallery-preview.component.d.ts" in your app.在您的应用中重写“ngx-gallery-helper.service.d.ts”和“ngx-gallery-preview.component.d.ts”。 But future possible update of ngx-gallery will cause problems.但是未来可能的 ngx-gallery 更新会导致问题。
  • Use other gallery or write your own.使用其他画廊或编写自己的画廊。

BTW https://github.com/thatisuday/ngx-image-gallery works well with Angular 9. Just checked.顺便说一句, https://github.com/thatisuday/ngx-image-gallery与 Angular 9 配合良好。刚刚检查过。 And good customisation.和良好的定制。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解析 Staging &amp; Prod 上的所有参数(AOT、buildOptimizer)(ng serve 有效) - Can't resolve all parameters (AOT, buildOptimizer) on Staging & Prod (ng serve works) ng-bootstrap和Angular 6:无法解析NgbModalRef的所有参数:(?,?,?,?) - ng-bootstrap and Angular 6: Can't resolve all parameters for NgbModalRef: (?,?,?,?) Angular-无法解析组件ng build --prod的所有参数 - Angular - Can't resolve ALL Parameters for component ng build --prod ng test显示错误:无法解析BackendService的所有参数 - `ng test` shows Error: Can't resolve all parameters for BackendService 无法解决 setupPlatform 的所有参数:(?, [object Object], [object Object]) 在 ionic serve 上出错 - Can't resolve all parameters for setupPlatform: (?, [object Object], [object Object]) error on ionic serve 无法解析 [...] 的所有参数 - Can't resolve all parameters for [...] 无法解析所有参数 - Can't resolve all parameters 将&#39;Params&#39;注入构造函数后,无法解析MeldunekEditComponent的所有参数(?) - Can't resolve all parameters for MeldunekEditComponent: (?) after injecting 'Params' to constructor 错误:使用ng build --prod构建时无法解析Service的所有参数 - ERROR in : Can't resolve all parameters for Service when build with ng build --prod 在ng build --prod期间无法解析验证指令中的所有参数 - Can't resolve all parameters in validation directive during ng build --prod
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM