【问题标题】:I want to use Vue js with Symfony 5, but I faced an error when run this command "yarn encore dev-server"我想在 Symfony 5 中使用 Vue js,但在运行此命令“yarn encore dev-server”时遇到错误
【发布时间】:2021-07-24 08:29:59
【问题描述】:

我在 Symfony 5 中使用 Vue.js 运行命令 yarn encore dev-server。我遇到了以下错误:

PS C:\Apache24\htdocs\api_example> yarn encore dev-server

yarn run v1.22.5

$ C:\Apache24\htdocs\api_example\node_modules\.bin\encore dev-server

Running webpack-dev-server ...

 RECOMMEND  To create a smaller (and CSP-compliant) build, see https://symfony.com/doc/current/frontend/encore/vuejs.html#runtime-compiler-build

**[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
 - options.client has an unknown property 'host'. These properties are valid:
   object { logging?, overlay?, progress?, webSocketTransport?, webSocketURL? }**


error Command failed with exit code 2.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

【问题讨论】:

    标签: symfony webpack-dev-server webpack-encore


    【解决方案1】:

    Webpack Dev Server 刚刚发布了一个新版本:v4.0.0-rc.0。它与 Webpack Encore 的(默认设置)不兼容。

    你可以坚持一段时间v4.0.0-beta.3,直到 Webpack Encore 更新支持新版本。

    使用yarn add webpack-dev-server@v4.0.0-beta.3 --dev 来使用这个确切的版本。

    关注this issue看看有没有进展,或者想快速修复使用新的webpack-dev-server

    【讨论】:

    • 我认为你的意思是 webpack,而不是你的 yarn add 命令的 webpack dev ......这似乎并不能解决问题。 :)
    • @MarcRunkel 谢谢!我的意思是webpack-dev-server。我已经更新了我的答案。
    • 这不应该放在 devDependencies 中吗? yarn add webpack-dev-server@v4.0.0-beta.3 -D
    • @Seybsen 你说得对,谢谢!我已经更新了我的答案。
    猜你喜欢
    • 2021-07-30
    • 2021-03-18
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 2021-10-07
    • 1970-01-01
    • 2018-09-28
    • 2022-06-30
    相关资源
    最近更新 更多