我最近将我的角度项目从版本8更新到了9,并且遇到了上述问题。我的项目使用了ngx-gallery
,并且在更新为angular 9之后,我将在Renderer
和Renderer2
内将对弃用的ngx-gallery-helper.service.d.ts
服务的所有引用更新为ngx-gallery-preview.component.d.ts
。
我当前安装的npx-gallery
版本是最新版本(5.10.0)。当我运行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)
在项目根文件夹中运行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
我想念什么?您的帮助将不胜感激。谢谢。
答案 0 :(得分:2)
文件“ ngx-gallery-helper.service.d.ts”和“ ngx-gallery-preview.component.d.ts”位于文件夹node_modules中。使用npm自动生成的Node_modules。文件夹“ node_modules”内部无法更改。它将使用npm重新创建。
解决错误的方法一定不是很难。照常。更改“ Renderer”->“ Renderer2”和相关项目。但确实有一个大问题-存储库中的这个画廊只有ngx-gallery的作者才能访问。
可以做什么:
BTW https://github.com/thatisuday/ngx-image-gallery与Angular 9一起使用效果很好。好的定制。