【问题标题】:Cannot run webpack-encore on Windows无法在 Windows 上运行 webpack-encore
【发布时间】:2020-09-14 09:51:51
【问题描述】:

我正在尝试将 webpack-encore 与 symfony 一起使用,但我遇到了问题。 首先我用 composer 安装了 webpack-encore:

composer require symfony/webpack-encore-bundle
yarn install

当我尝试运行 encore 时:

node node_modules/.bin/encore production

我收到此错误:

C:\wamp64\www\symfony1\node_modules\.bin\encore:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at wrapSafe (internal/modules/cjs/loader.js:1054:16)
    at Module._compile (internal/modules/cjs/loader.js:1102:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:1
0)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_ma
in.js:71:12)
    at internal/main/run_main_module.js:17:47

我的操作系统是 Windows 10,我认为 Windows 中的路径存在问题,但我不知道如何解决此问题。有人可以帮我吗?

【问题讨论】:

  • 你试过yarn encore prod吗?
  • 非常感谢!这为我节省了很多时间! :D
  • 不客气@Pietro Siccardi

标签: php windows symfony webpack-encore


【解决方案1】:

您可以尝试使用 yarn encore prod 用于生产环境 或者 yarn encore dev 用于开发环境

对于开发,您还可以使用: yarn encore dev --watch 如果你想自动重新编译你的资产:

见https://symfony.com/doc/current/frontend/encore/simple-example.html#configuring-encore-webpack

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-03
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多