第一个例子Encore - Path必须是一个字符串。收到undefined

时间:2017-06-20 13:04:10

标签: symfony webpack symfony-3.3 webpack-encore

我尝试在Symfony中使用Encore。

First example

我运行命令:

./node_modules/.bin/encore dev

这会给我带来错误:

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at find (/www/testencore/node_modules/babel-loader/lib/resolve-rc.js:11:21)
    at module.exports (/www/testencore/node_modules/@symfony/webpack-encore/lib/config/parse-runtime.js:64:47)
    at Object.<anonymous> (/www/testencore/node_modules/@symfony/webpack-encore/bin/encore.js:18:23)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

1 个答案:

答案 0 :(得分:2)

您的问题与babel-loader的v7.1有关。 (cfr。https://github.com/symfony/webpack-encore/issues/40

您可以通过将以下行添加到package.json

来解决此问题
"babel-loader": "7.0"

在此之后确保运行yarn upgrade,webpack-encore应该再次运行。

请注意,这是一个临时修复。您应该密切关注github问题,看看是否有可用的永久修复程序。

编辑:自Encore 0.9.1起修复此问题,更新应解决此问题。

相关问题