我已经升级了我的 Angular App 依赖项并成功安装了它们。不幸的是,我现在无法使用“rxjs”。下面是IDE返回的错误。
TS7016:找不到模块“rxjs”的声明文件。“C:/Path/to/project/node_modules/rxjs/dist/cjs/index.js”隐式具有“any”类型。尝试
npm i --save-dev @types/rxjs它是否存在或添加一个包含`declare module 'rxjs'的新声明(.d.ts)文件;
下面是我的 package.json
{
"engines": {
"node": "14.15.4",
"npm": "7.11.2"
},
"name": "furaha-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"serve": "ng serve",
"start": "node server.js",
"build": "ng build --prod --aot",
"test": "ng test",
"test-coverage": "ng test --code-coverage",
"lint": "ng lint",
"lint-fix": "npm run lint --fix",
"e2e": "ng e2e",
"snyk-protect": "snyk protect",
"prepare": "npm run snyk-protect"
},
"private": true,
"dependencies": {
"@angular-devkit/architect": "^0.1102.9",
"@angular-devkit/build-angular": "~0.1102.11",
"@angular/animations": "~11.2.12",
"@angular/cdk": "^11.2.11",
"@angular/cli": …Run Code Online (Sandbox Code Playgroud) 我正在RxJs7我的 Angular 12.2.0 项目中尝试,似乎 rxjs 运算符和方法的路径发生了变化。
我收到以下错误
./dist/candypal/website/fesm2015/candypal-website.js:8:0-50 - Error: Module not found: Error: Package path ./index is not exported from package /Users/aniruddh/aniruddh/develop/experiment/candypal/node_modules/rxjs (see exports field in /Users/aniruddh/aniruddh/develop/experiment/candypal/node_modules/rxjs/package.json)
Run Code Online (Sandbox Code Playgroud)
请注意,上述错误来自使用 rxjs7 的库
在尝试使用电容器构建离子项目时,有人遇到这个问题吗?
我有一个 Ionic 项目,其中每个功能都有不同的包。我正在尝试使用将我的项目导出到 android studio 中ionic capacitor build android。我还尝试创建一个带有空白页面的新项目,效果很好。我的怀疑是本地软件包,但我不知道如何解决这个问题,因为我是角度和离子的新手。
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @ionic-native/core@5.36.0
npm ERR! Found: rxjs@7.4.0
npm ERR! node_modules/rxjs
npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/common@15.0.2
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"15.0.2" from @angular/forms@15.0.2
npm ERR! node_modules/@angular/forms
npm ERR! peer @angular/forms@">=12.0.0" from @ionic/angular@6.3.9
npm ERR! node_modules/@ionic/angular
npm ERR! @ionic/angular@"^6.3.9" from the root project
npm ERR! 1 more (the root project)
npm …Run Code Online (Sandbox Code Playgroud) this.userService.addUser(this.user).subscribe(\n (data)=>{\n //success\n console.log(data);\n this._snack.open('Registered Successfully', 'OK', {\n duration: 2000,\n verticalPosition: 'top',\n horizontalPosition: 'center',\n panelClass: ['green-snackbar', 'login-snackbar'],\n });\n },\n (error)=>{\n //error\n console.log(error);\n this._snack.open('Something went Wrong', 'OK', {\n duration: 2000,\n verticalPosition: 'top',\n horizontalPosition: 'center',\n panelClass: ['red-snackbar','login-snackbar'],\n });\n }\n);\nRun Code Online (Sandbox Code Playgroud)\n我不知道到底发生了什么,但订阅显示已弃用,以下是消息
\n(method) Observable<Object>.subscribe(next?: ((value: Object) => void) | null | undefined, error?: ((error: any) => void) | null | undefined, complete?: (() => void) | null | undefined): Subscription (+2 overloads)\n@deprecated \xe2\x80\x94 Instead of passing separate callback arguments, use an observer …Run Code Online (Sandbox Code Playgroud)