question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

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:closed
  • Created 5 years ago
  • Reactions:63
  • Comments:60 (3 by maintainers)

github_iconTop GitHub Comments

64reactions
ulivzcommented, Mar 9, 2019

The dependency chain is webpack-serve -> koa-webpack -> webpack-dev-middleware, and it’s caused by the underlying webpack-dev-middleware@3.6.1, so If you’re a yarn user you can use resolutions for a temporary fix:

  "resolutions": {
    "webpack-dev-middleware": "3.6.0"
  }

While the npm user can re-install webpack-dev-middleware with a specific version:

npm install webpack-dev-middleware@3.6.0

When webpack-dev-middleware fixes the issue and publishes, the issue can be closed.

12reactions
abrahamdiocommented, Mar 10, 2019

@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,

  "resolutions": {
    "webpack-dev-middleware": "3.6.0"
  }

And run yarn install again. Hope you got it fixed 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found