1

我使用我在这里找到的文档安装 vuepress:

这一切都很好。但是,当我运行时:

vuepress dev

并转到我的 localhost:8080 我收到以下错误:

VuePress dev server listening at http://localhost:8080/
(node:44843) UnhandledPromiseRejectionWarning: TypeError: res.getHeader is not a function
    at processRequest (/usr/local/lib/node_modules/vuepress/node_modules/webpack-dev-middleware/lib/middleware.js:82:18)
    at ready (/usr/local/lib/node_modules/vuepress/node_modules/webpack-dev-middleware/lib/util.js:51:12)
    at handleRequest (/usr/local/lib/node_modules/vuepress/node_modules/webpack-dev-middleware/lib/util.js:167:5)
    at Promise (/usr/local/lib/node_modules/vuepress/node_modules/webpack-dev-middleware/lib/middleware.js:44:7)
    at new Promise (<anonymous>)
    at middleware (/usr/local/lib/node_modules/vuepress/node_modules/webpack-dev-middleware/lib/middleware.js:43:12)
    at Promise.all.Promise (/usr/local/lib/node_modules/vuepress/node_modules/koa-webpack/index.js:43:7)
    at new Promise (<anonymous>)
    at /usr/local/lib/node_modules/vuepress/node_modules/koa-webpack/index.js:42:5
    at dispatch (/usr/local/lib/node_modules/vuepress/node_modules/koa/node_modules/koa-compose/index.js:42:32)
    at /usr/local/lib/node_modules/vuepress/node_modules/@shellscape/koa-static/legacy/index.js:58:19
    at Generator.throw (<anonymous>)
    at step (/usr/local/lib/node_modules/vuepress/node_modules/@shellscape/koa-static/legacy/index.js:6:221)
    at _throw (/usr/local/lib/node_modules/vuepress/node_modules/@shellscape/koa-static/legacy/index.js:6:455)
(node:44843) 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:44843) [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.

我尝试安装:

npm install webpack-dev-middleware@3.6.0

但是并没有解决我的问题。关于我接下来可以做什么的任何想法?

4

1 回答 1

1

尝试删除 vuepress 并重新安装(全局)。

sudo npm remove vuepress -g或者npm remove vuepress

然后:

sudo npm install vuepress -g

于 2019-04-05T12:40:08.373 回答