![](/img/trans.png)
[英]karma: TypeError: Cannot read property 'prototype' of undefined
[英]Reactjs - × TypeError: Cannot read property 'prototype' of undefined
無法讀取未定義的屬性“原型”。 /node_modules/express/lib/response.js:42
當我將 React 應用程序與快速后端一起運行時,出現此錯誤。 應用程序運行良好,直到錯誤突然出現。
39 | * @public
40 | */
41 |
> 42 | var res = Object.create(http.ServerResponse.prototype)
43 |
這是我在控制台中得到的:
at Object.<anonymous> (response.js:42)
at Object../node_modules/express/lib/response.js (response.js:1142)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Object../node_modules/express/lib/express.js (express.js:22)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Object../node_modules/express/index.js (index.js:11)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Module../src/actions/index.js (index.js:1)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Module../src/containers/HomeContainer.js (UserPosts.js:53)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Module../src/components/home/home.js (sidenav_items.js:80)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Module../src/routes.js (user_reducer.js:17)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Module../src/index.js (HomeContainer.js:42)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Object.1 (BookItem.js:24)
at __webpack_require__ (bootstrap:785)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1```
嘗試將其添加到您的webpack配置中
target: 'node'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.