简体   繁体   English

无法在 Windows 上运行 webpack-encore

[英]Cannot run webpack-encore on Windows

I'm trying to use webpack-encore with symfony, but I'm having issues.我正在尝试将 webpack-encore 与 symfony 一起使用,但我遇到了问题。 First I installed webpack-encore with composer:首先我用 composer 安装了 webpack-encore:

composer require symfony/webpack-encore-bundle
yarn install

When I try to run encore with:当我尝试运行 encore 时:

node node_modules/.bin/encore production

I get this error:我收到此错误:

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

My OS is Windows 10, i believe that there is a problem with paths in Windows, but I don't know how to solve this issue.我的操作系统是 Windows 10,我相信 Windows 中的路径有问题,但我不知道如何解决这个问题。 Can someone help me?有人能帮我吗?

You can try using yarn encore prod for production environment or yarn encore dev for development environment您可以尝试在生产环境中使用yarn encore prod或在开发环境中使用yarn encore dev

For development, You can use also: yarn encore dev --watch If you want to recompile automatically your assets:对于开发,您也可以使用: yarn encore dev --watch如果您想自动重新编译您的资产:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM