第一个示例Encore - 路径必须是字符串。收到undefined
问题描述:
我尝试在Symfony中使用Encore。第一个示例Encore - 路径必须是字符串。收到undefined
我运行命令:
./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)
答
您的问题与巴别塔型装载机V7.1做。 (CFR。https://github.com/symfony/webpack-encore/issues/40)
可以通过添加下面一行到你的package.json
"babel-loader": "7.0"
后解决这个问题这确保运行yarn upgrade
,的WebPack-安可应该重新工作。
请注意,这是一个临时修复。你应该留意github问题,看看是否有永久修复。
编辑:这已被修复,因为Encore 0.9.1
,更新应该解决问题。
请注意,有一个命令'yarn upgrade',而不是删除锁定文件并重新构建它。 – user254319
确实更干净,更新了答案,谢谢:) –