req.handle.writev 不是函数

Posted

技术标签:

【中文标题】req.handle.writev 不是函数【英文标题】:req.handle.writev is not a function 【发布时间】:2019-01-05 03:31:57 【问题描述】:

我在 Docker 容器中为我的项目使用 React、React-Redux 和 Webpack,但一直遇到这个错误

内部/stream_base_commons.js:59 var err = req.handle.writev(req, 块,所有缓冲区); ^

TypeError: 在 writevGeneric (internal/stream_base_commons.js:59:24) 在 Socket._writeGeneric (net.js:758:5) 在 Socket._writev (net.js:767:8) 在 doWrite (_stream_writable.js:408:12) 在 clearBuffer (_stream_writable.js:517:5) 在 Socket.Writable.uncork (_stream_writable.js:314:7) 在连接CorkNT (_http_outgoing.js:646:8) 在 process._tickCallback (internal/process/next_tick.js:63:19)

以下是我的版本

    NODE_VERSION 8.9 YARN_VERSION 1.7.0 OS Docker Linux/Raspbian Lite Webpack/Webpack-Ddv-Server(最新) React/Redux(最新)

我的 package.json


  ....
  "dependencies": 
    "object-assign": "*",
    "raf": "*",
    "react": "*",
    "react-dev-utils": "*",
    "react-dom": "*",
    "react-facebook-login": "*",
    "react-helmet": "*",
    "react-loadable": "*",
    "react-slick": "*",
    "react-router": "*",
    "react-router-dom": "*",
    "react-redux":"*",
    "redux":"*",
    "redux-thunk":"*",
    "slick-carousel":"*",
    "font-awesome":"*"
  ,
  "devDependencies": 
    "postcss-flexbugs-fixes": "3.2.0",
    "postcss-loader": "2.0.8",
    "promise": "8.0.1",
    "autoprefixer": "7.1.6",
    "babel-core": "6.26.0",
    "babel-eslint": "7.2.3",
    "babel-jest": "20.0.3",
    "babel-loader": "7.1.2",
    "babel-preset-react-app": "^3.1.1",
    "babel-runtime": "6.26.0",
    "case-sensitive-paths-webpack-plugin": "2.1.1",
    "node-sass-chokidar": "*",
    "npm-run-all": "*",
    "sass-loader": "*",
    "sw-precache-webpack-plugin": "0.11.4",
    "resolve": "1.6.0",
    "style-loader": "0.19.0",
    "url-loader": "0.6.2",
    "webpack": "*",
    "webpack-dev-server": "*",
    "webpack-manifest-plugin": "*",
    "whatwg-fetch": "2.0.3",
    "chalk": "1.1.3",
    "css-loader": "0.28.7",
    "dotenv": "4.0.0",
    "dotenv-expand": "4.2.0",
    "eslint": "4.10.0",
    "eslint-config-react-app": "^2.1.0",
    "eslint-loader": "1.9.0",
    "eslint-plugin-flowtype": "2.39.1",
    "eslint-plugin-import": "2.8.0",
    "eslint-plugin-jsx-a11y": "5.1.1",
    "eslint-plugin-react": "7.4.0",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "*",
    "fs-extra": "*",
    "html-webpack-plugin": "*",
    "jest": "20.0.4"
  ,
  "scripts": 
    "start-js": "node scripts/start.js",
    "start": "npm-run-all -p watch-css start-js",
    "build-js": "node scripts/build.js",
    "build": "npm-run-all build-css build-js",
    "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
    "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
    "test": "node scripts/test.js --env=jsdom",
    "postinstall": "npm run start"
  ,
  "jest": 
    "collectCoverageFrom": [
      "src/**/*.js,jsx,mjs"
    ],
    "setupFiles": [
      "<rootDir>/config/polyfills.js"
    ],
    "testMatch": [
      "<rootDir>/src/**/__tests__/**/*.js,jsx,mjs",
      "<rootDir>/src/**/?(*.)(spec|test).js,jsx,mjs"
    ],
    "testEnvironment": "node",
    "testURL": "http://localhost",
    "transform": 
      "^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
      "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
      "^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
    ,
    "transformIgnorePatterns": [
      "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
    ],
    "moduleNameMapper": 
      "^react-native$": "react-native-web"
    ,
    "moduleFileExtensions": [
      "web.js",
      "js",
      "json",
      "web.jsx",
      "jsx",
      "node",
      "mjs"
    ]
  ,
  "babel": 
    "presets": [
      "react-app"
    ]
  ,
  "eslintConfig": 
    "extends": "react-app"
  

还有其他人有这个问题吗?不会经常发生,但会阻碍开发过程

【问题讨论】:

也许是github.com/nodejs/node/issues/21665 ? 【参考方案1】:

我在 NodeJS 版本 10.13.0 上的 Windows 10 x64 上收到此错误。我只是删除了 NodeJS 版本 10.13.0 并安装了版本 8.11.3 并重新启动了我的机器,它就消失了!

【讨论】:

【参考方案2】:

还有其他人有这个问题吗?是的...这个问题经常发生在我身上,这让我很紧张,但通常情况下,当它发生时,我重新启动我的电脑,它就消失了!

目前,我认为重新启动计算机是解决方案,因为我搜索了太多解决方案,但结果为零。

【讨论】:

此后有一些更新,从我收集到的信息来看,这与使用 https 有很大关系。更新您的依赖项【参考方案3】:

删除节点并安装纱线

【讨论】:

以上是关于req.handle.writev 不是函数的主要内容,如果未能解决你的问题,请参考以下文章

解析云代码函数响应成功不是函数

从头开始定义列表函数而不是库函数

为啥这个视图函数不是免费的以太函数?

为啥导出的模块错误报告定义的函数“不是函数”

jQuery datepicker 函数:datepicker 不是函数

这个函数是啥使它不是函数