vuepress dev: throws res.getHeader() is not a function
See original GitHub issue- I confirm that this is an issue rather than a question.
Bug report
- Related issue: https://github.com/webpack/webpack-dev-middleware/issues/380
- PR fix: https://github.com/shellscape/koa-webpack/pull/110
Version
- vuepress@0.14.10
- Reproduce same fault with node v10.9.0 AND node v8.11.4
- Windows 10
Steps to reproduce
NOTE: This was a first time use of vuepress.
$ npm i -g vuepress
$ echo "# Some Stuff" >> README.md
$ vuepress dev
> VuePress dev server listening at http://localhost:8080/
Visit http://localhost:8080/
in browser
Server throws …
(node:14508) UnhandledPromiseRejectionWarning: TypeError: res.getHeader is not a function
at processRequest (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\webpack-dev-middleware\lib\middleware.js:82:18)
at ready (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\webpack-dev-middleware\lib\util.js:51:12)
at handleRequest (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\webpack-dev-middleware\lib\util.js:167:5)
at Promise (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\webpack-dev-middleware\lib\middleware.js:44:7)
at new Promise (<anonymous>)
at middleware (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\webpack-dev-middleware\lib\middleware.js:43:12)
at Promise.all.Promise (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\koa-webpack\index.js:43:7)
at new Promise (<anonymous>)
at C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\koa-webpack\index.js:42:5
at dispatch (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\koa\node_modules\koa-compose\index.js:42:32)
at C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\@shellscape\koa-static\legacy\index.js:58:19
at Generator.throw (<anonymous>)
at step (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\@shellscape\koa-static\legacy\index.js:6:221)
at _throw (C:\ProgramData\nvm\v10.9.0\node_modules\vuepress\node_modules\@shellscape\koa-static\legacy\index.js:6:455)
(node:14508) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14508) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:63
- Comments:60 (3 by maintainers)
Top Results From Across the Web
Launching a local host environment with vuepress gives a res ...
getHeader is not a function at processRequest (/usr/local/lib/node_modules/vuepress/node_modules/webpack-dev-middleware/lib/middleware.js:82:18) ...
Read more >UnhandledPromiseRejectionWar...
VuePress dev server listening at http://localhost:8080/ ... TypeError: res.getHeader is not a function at processRequest (D:\刘 ...
Read more >VuePress报错TypeError: res.getHeader is not a function
首先初始化一个项目npm init -y 安装vuepress npm install -D vuepress 创建文件夹mkdir docs 在docs下面创建README.md echo '# Hello VuePress' ...
Read more >VuePressを起動するとres.getHeader is not a functionエラー ...
VuePress dev server listening at (http://localhost:8080/) (node:35968) UnhandledPromiseRejectionWarning: TypeError: res.getHeader is not a ...
Read more >Google Cloud Function Error - Res.Setheader Is Not A Function
Edit on GitHub setHeader(name, value); response. Any unused sockets in the pool will be unrefed so as not to keep the Node.js process...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The dependency chain is
webpack-serve -> koa-webpack -> webpack-dev-middleware
, and it’s caused by the underlyingwebpack-dev-middleware@3.6.1
, so If you’re a yarn user you can useresolutions
for a temporary fix:While the npm user can re-install
webpack-dev-middleware
with a specific version:When
webpack-dev-middleware
fixes the issue and publishes, the issue can be closed.@edadams Sorry if my answer confused you, I didn’t have so much time at that point to dig down which dependency is the culprit.
Since @ulivz has found the exact module that caused the issue, you can override that module version in your
package.json
, you can read more about the yarn’s resolution docs here, https://yarnpkg.com/lang/en/docs/selective-version-resolutions/What you want to do is to edit your
package.json
file, and add,And run
yarn install
again. Hope you got it fixed 😃