角度可注射错误:预期有0个参数,但有1个

时间:2019-04-06 06:13:03

标签: angular typescript ionic-framework

我知道这个问题已经问过here,但是我无法解决我的错误。

我刚刚开始离子项目,并使用此link通过angular使用auth。

所有工作文件,但当我使用

@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").

当我使用http更新ng update @angular/http时,我又得到了这个Package "@ionic-native/core" has an incompatible peer dependency to "rxjs" (requires "^5.5.11", would install "6.4.0").

所以我无法升级@angular/core

PS:我对离子/角接触是完全陌生的,而且我不知道我在core version中是否遇到问题。

注意:我尝试过ng updateng 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 /角度7.3.8

@ schematics /更新0.13.8

rxjs 5.5.11

打字稿2.6.2

webpack 3.12.0

1 个答案:

答案 0 :(得分:1)

我不确定,但我认为这似乎是一种僵局。您可以手动更新以下angularrxjs版本并执行

npm i

,然后尝试更新ionic

    "@angular/animations": "7.1.4",
    "@angular/common": "7.1.4",
    "@angular/compiler": "7.1.4",
    "@angular/core": "7.1.4",
    "@angular/forms": "7.1.4",
    "@angular/http": "7.1.4",
    "@angular/material": "7.2.1",
    "@angular/platform-browser": "7.1.4",
    "@angular/platform-browser-dynamic": "7.1.4",
    "@angular/router": "7.1.4",     
    "classlist.js": "1.1.20150312",
    "core-js": "2.6.1",
    "omni-slider": "1.2.1",
    "pikaday": "1.8.0",
    "rxjs": "6.3.3",
    "web-animations-js": "2.3.1",
    "zone.js": "0.8.26"