Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/encore dev-server: Path must be a string #40

Closed
FloFrad opened this issue Jun 20, 2017 · 8 comments
Closed

bin/encore dev-server: Path must be a string #40

FloFrad opened this issue Jun 20, 2017 · 8 comments

Comments

@FloFrad
Copy link

FloFrad commented Jun 20, 2017

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

@giraz82
Copy link

giraz82 commented Jun 20, 2017

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.

@kristoffeys
Copy link

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.

@FloFrad
Copy link
Author

FloFrad commented Jun 20, 2017

It works for me too ! Thanks guys

@FloFrad FloFrad closed this as completed Jun 20, 2017
@stof
Copy link
Member

stof commented Jun 20, 2017

@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)

@weaverryan
Copy link
Member

Thanks @stof I'm working on a PR right now!

@bogdaniel
Copy link

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"
  }
}

@LMSzor
Copy link

LMSzor commented Jul 3, 2017

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.

@stof
Copy link
Member

stof commented Jul 3, 2017

you should upgrade to Encore 0.9.1, which now uses Babel 7.1 (and a bunch of fixes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants