Object(...) is not a function Error with Angular in-memory-web-api 0.6.0




Asked on April 23, 2018
I updated Angular in-memory-web-api and I got it as 

"angular-in-memory-web-api": "^0.6.0" in package.json
But when run the application, I am getting following error in browser console. How to fix it?


ERROR {…}?body: Object { error: "Object(...) is not a function" }?headers: Object { normalizedNames: Map, lazyUpdate: null, lazyInit: lazyInit() }?status: 500?

statusText: "Internal Server Error"?url: "/api/users"?__proto__: Object { … } core.js:1665:5
defaultErrorLogger webpack-

internal:///./node_modules/@angular/core/esm5/core.js:1665:5
ErrorHandler.prototype.handleError webpack-internal:///./node_modules/@angular/core/esm5/core.js:1726:9

next webpack-internal:///./node_modules/@angular/core/esm5/core.js:5724:119
EventEmitter.prototype.subscribe/schedulerFn< webpack-

internal:///./node_modules/@angular/core/esm5/core.js:4558:36
SafeSubscriber.prototype.__tryOrUnsub webpack-

internal:///./node_modules/rxjs/_esm5/Subscriber.js:248:13
SafeSubscriber.prototype.next webpack-internal:///./node_modules/rxjs/_esm5/Subscriber.js:195:17

Subscriber.prototype._next webpack-internal:///./node_modules/rxjs/_esm5/Subscriber.js:136:9
Subscriber.prototype.next webpack-

internal:///./node_modules/rxjs/_esm5/Subscriber.js:100:13
Subject.prototype.next webpack-internal:///./node_modules/rxjs/_esm5/Subject.js:65:17

EventEmitter.prototype.emit webpack-internal:///./node_modules/@angular/core/esm5/core.js:4538:24
onHandleError/< webpack-

internal:///./node_modules/@angular/core/esm5/core.js:4998:57
ZoneDelegate.prototype.invoke webpack-internal:///./node_modules/zone.js/dist/zone.js:388:17

Zone.prototype.run webpack-internal:///./node_modules/zone.js/dist/zone.js:138:24
NgZone.prototype.runOutsideAngular webpack-

internal:///./node_modules/@angular/core/esm5/core.js:4924:54
onHandleError webpack-internal:///./node_modules/@angular/core/esm5/core.js:4998:13

ZoneDelegate.prototype.handleError webpack-internal:///./node_modules/zone.js/dist/zone.js:392:17
Zone.prototype.runTask webpack-

internal:///./node_modules/zone.js/dist/zone.js:191:25
ZoneTask.invokeTask webpack-internal:///./node_modules/zone.js/dist/zone.js:496:24
ZoneTask/this.invoke 

webpack-internal:///./node_modules/zone.js/dist/zone.js:485:28
timer webpack-internal:///./node_modules/zone.js/dist/zone.js:2054:17




Replied on April 23, 2018
angular-in-memory-web-api   version 0.6.0 works with RxJS v6

Check your RxJS version in package.json

You can solve your error by using angular-in-memory-web-api   version 0.5.4

Use following command:

npm uninstall angular-in-memory-web-api --save

npm i angular-in-memory-web-api@0.5.4 --save

Reference:


0.6.0 (2018-03-22)

Migrate to Angular v6 and RxJS v6

Note that this release is pinned to Angular "^6.0.0-rc.0" and RxJS "^6.0.0-beta.1". Will likely update again when they are official.

BREAKING CHANGE This version depends on RxJS v6 and is not backward compatible with earlier RxJS versions.





Replied on April 23, 2018
Thanks. I got it.

Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us