Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Reactjs-×;TypeError:无法读取属性';原型&x27;未定义的_Javascript_Node.js_Reactjs_Express - Fatal编程技术网

Javascript Reactjs-×;TypeError:无法读取属性';原型&x27;未定义的

Javascript Reactjs-×;TypeError:无法读取属性';原型&x27;未定义的,javascript,node.js,reactjs,express,Javascript,Node.js,Reactjs,Express,无法读取未定义的属性“prototype”/node_modules/express/lib/response.js:42 当我与express后端一起运行react应用程序时,出现此错误。应用程序运行正常,直到不知从何处出现错误 39 | * @public 40 | */ 41 | > 42 | var res = Object.create(http.ServerResponse.prototype) 43 | 这是我在控制台中得到的: at Obj

无法读取未定义的属性“prototype”/node_modules/express/lib/response.js:42

当我与express后端一起运行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```
at对象。(回复:js:42)
在Object../node_modules/express/lib/response.js(response.js:1142)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
在Object../node_modules/express/lib/express.js(express.js:22)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
在Object../node_modules/express/index.js(index.js:11)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
在模块处../src/actions/index.js(index.js:1)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
位于Module../src/containers/HomeContainer.js(UserPosts.js:53)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
位于Module../src/components/home/home.js(sidenav_items.js:80)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
在Module../src/routes.js(user_reducer.js:17)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
在Module../src/index.js(HomeContainer.js:42)
at __;网页_;需要___;(引导:785)
在fn(引导:150)
在Object.1(BookItem.js:24)
at __;网页_;需要___;(引导:785)
在CheckDeferredModule(引导:45)
在Array.webpackJsonpCallback[作为推送](引导:32)
在main.chunk.js:1```

尝试将其添加到您的网页配置中

target: 'node'

我假设您已经完成了所有基本的事情,比如重新启动、清除node_模块和重新安装等。BookItem.js中的第24行是什么?它是一个呈现书籍项目的组件。它是我创建的第一批组件之一,并且一直在工作。