gofac
gofac

Reputation: 21

First Example Encore - Path must be a string. Received undefined

I try to use Encore in Symfony.

First example

I run command:

./node_modules/.bin/encore dev

and this return me 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 (/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)

Upvotes: 2

Views: 768

Answers (1)

Kristof Feys
Kristof Feys

Reputation: 1842

Your issue has to do with v7.1 of babel-loader. (cfr. https://github.com/symfony/webpack-encore/issues/40)

You can fix the issue by adding the following line to your package.json

"babel-loader": "7.0"

After this make sure to run yarn upgrade, webpack-encore should work again.

Note that this is a temporary fix. You should keep an eye on the github issue to see if there's a permanent fix available.

EDIT: This has been fixed since Encore 0.9.1, updating should solve the issue.

Upvotes: 2

Related Questions