Angular教程,InMemoryWebApiModule抛出500个内部服务器错误,其中angular-in-memory-web-api 0.6.0 [英] Angular tutorial, InMemoryWebApiModule throwing 500 internal server error with angular-in-memory-web-api 0.6.0

查看:214
本文介绍了Angular教程,InMemoryWebApiModule抛出500个内部服务器错误,其中angular-in-memory-web-api 0.6.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

InMemoryWebApiModule正在使用下载的源代码,其中 "angular-in-memory-web-api": "~0.5.0"但不适用于"angular-in-memory-web-api": "^0.6.0" 我已按照该教程进行操作,以安装angular-in-memory-web-api:

InMemoryWebApiModule is working with downloaded source code where "angular-in-memory-web-api": "~0.5.0" But not with"angular-in-memory-web-api": "^0.6.0" I have followed the tutorial,to install angular-in-memory-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

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

推荐答案

类似于

Looks like the 0.6.0 release of angular-in-memory-web-api has some breaking changes, which are likely out of sync with the versions of angular and rxjs that the tutorial has had you install.

最简单的解决方法是安装0.5.4版本的angular-in-memory-web-api:

Simplest fix is just to install the 0.5.4 version of angular-in-memory-web-api:

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

这篇关于Angular教程,InMemoryWebApiModule抛出500个内部服务器错误,其中angular-in-memory-web-api 0.6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆