Good day !
Since I updated my project to 4.0.0-beta.12 I have been getting the following error.
ERROR in src/app/pages/deactivate-device/deactivate-device.ts(171,53): error TS2
339: Property ‘timeout’ does not exist on type ‘Observable <Response’.
I add to page.
import {timeout} from ‘rxjs/operators’;
I use.
this.http.post(this.actions, data).timeout(40000).subscribe(serverData => {
}, err => { }
ionic info:
Ionic:
ionic (Ionic CLI) : 4.2.1 (C:\Users\anton\AppData\Roaming\npm\nod
e_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.12
@angular-devkit/build-angular : 0.7.5
@angular-devkit/schematics : 0.7.5
@angular/cli : 6.1.5
@ionic/angular-toolkit : not installed
Cordova:
cordova (Cordova CLI) : 7.1.0
Cordova Platforms : not available
Cordova Plugins : not available
System:
(C:\Users\AppData\Local\Android\sdk)
NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 7
I don’t think it’s related to the upgrade to Ionic but rather to a not correct use of rxjs timeout as of rxjs 6
Here an example of timeout pipe:
import {timeout} from 'rxjs/operators';
this.anObservable()
.pipe(
timeout(4000)
).subscribe((result: any) => {
console.log('Cool');
}, (err: any) => {
console.log('Not cool');
});
reedrichards, it helps … thank you very much… but project dose not build … I see strange errors … what I did wrong ?
ERROR in …/node_modules/@angular/core/src/facade/async.js
Module not found: Error: Can’t resolve ‘rxjs/Observable’ in ‘D:\tmp\ionic2\node_
modules@angular\core\src\facade’
ERROR in …/node_modules/@angular/forms/src/facade/async.js
Module not found: Error: Can’t resolve ‘rxjs/Observable’ in ‘D:\tmp\ionic2\node_
modules@angular\forms\src\facade’
ERROR in …/node_modules/@angular/http/src/backends/jsonp_backend.js
Module not found: Error: Can’t resolve ‘rxjs/Observable’ in ‘D:\tmp\ionic2\node_
modules@angular\http\src\backends’
ERROR in …/node_modules/@angular/http/src/backends/xhr_backend.js
Module not found: Error: Can’t resolve ‘rxjs/Observable’ in ‘D:\tmp\ionic2\node_
modules@angular\http\src\backends’
ERROR in …/node_modules/@angular/core/src/facade/async.js
Module not found: Error: Can’t resolve ‘rxjs/Subject’ in ‘D:\tmp\ionic2\node_mod
ules@angular\core\src\facade’
ERROR in …/node_modules/@angular/forms/src/facade/async.js
Module not found: Error: Can’t resolve ‘rxjs/Subject’ in ‘D:\tmp\ionic2\node_mod
ules@angular\forms\src\facade’
ERROR in …/node_modules/@angular/forms/src/model.js
Module not found: Error: Can’t resolve ‘rxjs/observable/fromPromise’ in ‘D:\tmp
ionic2\node_modules@angular\forms\src’
ERROR in …/node_modules/@angular/forms/src/validators.js
Module not found: Error: Can’t resolve ‘rxjs/operator/toPromise’ in ‘D:\tmp\ioni
c2\node_modules@angular\forms\src’
ERROR in …/node_modules/@angular/core/src/util/lang.js
Module not found: Error: Can’t resolve ‘rxjs/symbol/observable’ in ‘D:\tmp\ionic
2\node_modules@angular\core\src\util’
which rxjs version are you using aka which rxjs version is defined in your package.json?
You may want to either downgrade to rxjs version 5 (perhaps 5.5.12), or update your code for version 6. I had a similar issue when I upgraded to version 6, 'cos I didn’t realize that there was a lot of changes in 6, so I had to downgrade to 5.5.12.
This link might help https://www.academind.com/learn/javascript/rxjs-6-what-changed/
Good luck.
and @angular/...
?
maybe something went bad during the installation? have you try to remove node_modules
and reinstall all the libs?
obinnae,thanks a lot.
reedrichards, I reinstalled node_modules… it dose not help.
“@angular/cli”: “~6.1.1”,
“@angular/compiler”: “~6.1.1”,
“@angular/compiler-cli”: “~6.1.1”,
“@angular/language-service”: “~6.1.1”,
“@angular-devkit/architect”: “~0.7.2”,
“@angular-devkit/build-angular”: “~0.7.2”,
“@angular-devkit/core”: “~0.7.2”,
“@angular-devkit/schematics”: “~0.7.2”,
that’s super weird, you are using Ionic v4 right?
did you do a clean/force install of the dependencies?
rm -r node_modules
rm package-lock.json
npm install
reedrichards, it helps. Thank you very much !
it’s solved now doing so?