【发布时间】:2019-08-28 00:10:33
【问题描述】:
我知道这个问题已经问过here,但我无法解决我的错误。
我刚刚开始了 ionic 项目并使用这个 link 使用 angular 来使用身份验证。
所有工作文件,但当我使用时
@Injectable({
providedIn: 'root'
})
我遇到错误
Typescript Error
Expected 0 arguments, but got 1.
我遵循上面链接中提到的每个步骤,例如:
1:npm install npm@latest -g
2:npm install -g @angular/cli, npm install @angular/cli
3:ng update @angular/cli
但是当我使用第四步时ng update @angular/core 我得到了这个Package "@ionic-native/splash-screen" has an incompatible peer dependency to "rxjs" (requires "^5.5.11", would install "6.4.0").
当我运行ng update rxjs 时,我得到了这个Package "@angular/http" has an incompatible peer dependency to "rxjs" (requires "^5.5.0", would install "6.4.0").
当我使用ng update @angular/http 更新http 时,我又得到了这个Package "@ionic-native/core" has an incompatible peer dependency to "rxjs" (requires "^5.5.11", would install "6.4.0").
所以我无法升级@angular/core。
PS:我对 ionic / angular 完全陌生,我不知道我在 core version 或其他方面是否有问题。
注意:我试过ng update、ng update --all,也试过清理卸载并重新安装,但到目前为止没有任何效果。
版本:
Ionic Framework: 3.9.3
Ionic App Scripts: 3.2.3
Angular Core: ^5.2.11
Angular Compiler CLI: 5.2.11
Node: 10.15.3
OS Platform: Windows 7
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/73.0.3683.86 Safari/537.36
Angular CLI:7.3.8
节点:10.15.3
操作系统:win32 x64
角度:5.2.11
...动画、通用、编译器、核心、表单、http
...平台浏览器、平台浏览器动态、路由器
包版本
@angular-devkit/architect 0.13.8
@angular-devkit/build-optimizer 0.0.35
@angular-devkit/core 7.3.8
@angular-devkit/schematics 7.3.8
@angular/cli 7.3.8
@angular/compiler-cli 7.2.12
@schematics/angular 7.3.8
@schematics/更新 0.13.8
rxjs 5.5.11
打字稿 2.6.2
webpack 3.12.0
【问题讨论】:
-
我从未使用过离子。但是您使用的是 3.9.3 版本,它取决于一个比您要升级到的版本更旧的 Angular 版本。当前版本的 Ionic 是 4.2.0。如果你刚开始一个 ionic 项目,为什么要从旧版本开始?
-
在stackblitz中重现问题。
-
看起来您在构造函数或函数中提供了一些预期之外的参数
标签: angular typescript ionic-framework