无法在 Windows 上运行 webpack-encore

我正在尝试将 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中的路径有问题,但我不知道如何解决这个问题。有人能帮我吗?


芜湖不芜
浏览 37回答 1
1回答

哈士奇WWW

您可以尝试用于 yarn encore prod 生产环境或 yarn encore dev 开发环境对于开发,您还可以使用: yarn encore dev --watch 如果您想自动重新编译您的资产:请参阅https://symfony.com/doc/current/frontend/encore/simple-example.html#configuring-encore-webpack
打开App,查看更多内容
随时随地看视频慕课网APP