InMemoryWebApiModule正在使用下载源代码 where "angular-in-memory-web-api": "~0.5.0",而不是"angular-in-memory-web-api": "^0.6.0"--我遵循了本教程,以安装内存中的角度-web-api:
npm install angular-in-memory-web-api --save并安装了"angular-in-memory-web-api": "^0.6.0"
错误信息:
webpack-internal:///./src/app/hero.service.ts:87 Object body: error: "Object(...) is not a function" __proto__: Object headers: HttpHeaders lazyInit: ƒ () lazyUpdate: null normalizedNames: Map(0) {} __proto__: Object status: 500statusText: "Internal Server Error" url: "api/heroes" __proto__: Object (anonymous) @ webpack-internal:///./src/app/hero.service.ts:87
发布于 2018-03-26 03:28:41
看起来,内存中的角度-web-api的0.6.0释放有一些突破性的变化,这很可能与教程中安装的角和rxjs的版本不同步。
最简单的修复方法就是安装0.5.4版本的“内存中的角”-web:
npm install angular-in-memory-web-api@0.5.4 --save
发布于 2018-03-26 03:55:38
这确实是内存中的角度网络api版本的一个问题。
我按zyzof的建议强制安装了v0.5.4,并立即修复了它!谢谢
npm install angular-in-memory-web-api@0.5.4 --save发布于 2018-03-27 18:54:05
我有同样的问题,并通过卸载和重新安装来解决它。我最初认为这是一个身份验证问题,因为我曾经使用firebase使用Angular匿名登录,但我以前使用的内存中的web教程是未经身份验证的应用程序。
https://stackoverflow.com/questions/49458598
复制相似问题