Hi,
I'm trying to use webpack-encore in my Symfony3 project with this doc but when I execute:
./node_modules/.bin/encore dev-server
I'm getting this error:
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 (/Users/xxx/Sites/tp/node_modules/babel-loader/lib/resolve-rc.js:11:21)
at module.exports (/Users/xxx/Sites/tp/node_modules/@symfony/webpack-encore/lib/config/parse-runtime.js:64:47)
at Object.<anonymous> (/Users/xxx/Sites/xxx/tp-trepia/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)
My config:
macOS Sierra 10.12.5
node -v -> v6.11.0
npm -v -> 3.10.10
Looking on google, some people advise to downgrade to node v5 but the same error appears.
Thanx
It seems to be related to babel-loader.
I have two projects created two hours away from each other.
The first in package-lock has babel-loader 7.0 and it works, the new one has babel-loader 7.1 and it doesn't work.
can confirm what @giraz82 said.
Have added "babel-loader": "7.0" to my package.json & removed lock file.
After these actions, webpack-encore seems to work again.
It works for me too ! Thanks guys
@weaverryan I think we might be misusing babel-loader/lib/resolve-rc. It looks like the function requires 2 arguments, not 1, but we pass only one (and changes in the internal implementation in babel-loader 7.1 might be less forgiving)
Thanks @stof I'm working on a PR right now!
with babel 7.0 i started getting same error .. but with this setup seems to work
{
"devDependencies": {
"babel-loader": "^7.0.0",
"@symfony/webpack-encore": "^0.8.0",
"babel-preset-es2017": "^6.24.1",
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.6",
"sass-loader": "^6.0.6"
},
"dependencies": {
"dropzone": "^5.1.0",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"popper.js": "^1.10.2",
"tinymce": "^4.6.4"
}
}
I had the same problem, and setup posted @bogdaniel really helped. Somehow placing babel-loader before @symfony/webpack-encore, and updating @symfony/webpack-encore to 0.8 from 0.7.2 fixed things up for me.
you should upgrade to Encore 0.9.1, which now uses Babel 7.1 (and a bunch of fixes)
Most helpful comment
Thanks @stof I'm working on a PR right now!