【问题标题】:First Example Encore - Path must be a string. Received undefined第一个示例 Encore - 路径必须是字符串。收到未定义
【发布时间】:2017-06-20 13:04:10
【问题描述】:

我尝试在 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)

【问题讨论】:

    标签: symfony webpack symfony-3.3 webpack-encore


    【解决方案1】:

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

    您可以通过将以下行添加到您的 package.json 来解决此问题

    "babel-loader": "7.0"
    

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

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

    编辑:Encore 0.9.1 以来已修复此问题,更新应该可以解决问题。

    【讨论】:

    • 注意这里有个命令yarn upgrade,而不是删除锁文件重新重建。
    猜你喜欢
    • 1970-01-01
    • 2019-06-04
    • 1970-01-01
    • 2016-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-23
    相关资源
    最近更新 更多