- configuration.output.path: The provided value "public" is not an absolute path! with Webpack

node.jsLaravel

node.js Problem Overview


I'm using Laravel Mix, that is based on WebPack.

I had it working, and now, it fails with:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.output.path: The provided value "public" is not an absolute path!

If I delete my webpack.mix.js content, it still fails the same way.

Can you help me debug this error, I have no clue how to go forward.

I have already deleted the node_modules folder, and ran npm install, it is still failing.

Any idea how should I solve this?

node.js Solutions


Solution 1 - node.js

Use __dirname

e.g.

output: {
    path: __dirname + "/dist/js", // or path: path.join(__dirname, "dist/js"),
    filename: "bundle.js"
}

https://stackoverflow.com/questions/42166492/getting-error-output-path-needs-to-be-an-absolute-path-or

Solution 2 - node.js

Lock webpack to 2.2.1 in composer.json

"devDependencies": {
    ...
    "webpack": "2.2.1",
    "laravel-mix": "^0.8.1",
    ...
}

As referenced here:

https://github.com/JeffreyWay/laravel-mix/issues/595

Solution 3 - node.js

Quoting this comment:

> For anyone else wondering how to take advantage of that fix, you can edit your package.json and make sure your larave-mix version is 0.10 or higher: > > "laravel-mix": "^0.10.0", > > Then run npm update.

I think the best (cleanest) solution is to update the Laravel Mix to last version (0.12 today)

Solution 4 - node.js

It seems to be a Laravel Mix Incompatibility with Webpack 2.3.0 --> https://github.com/JeffreyWay/laravel-mix/issues/595

Solution 5 - node.js

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.output.path: The provided value "public" is not an absolute path! -> The output directory as absolute path (required).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJuliatzinView Question on Stackoverflow
Solution 1 - node.jszonoView Answer on Stackoverflow
Solution 2 - node.jsNittany NationView Answer on Stackoverflow
Solution 3 - node.jsrap-2-hView Answer on Stackoverflow
Solution 4 - node.jsJuliatzinView Answer on Stackoverflow
Solution 5 - node.jsMykola TofanView Answer on Stackoverflow