I've just moved from Elixr to Mix and am getting errors when trying to compile. Its telling me images are not found when they are most definitley there. One of the errors for example:
error in ./resources/assets/images/revolution/823a1-banner-1.jpg
Module build failed: Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
Referenced from: /Users/Luke/Desktop/Sites/Site/node_modules/mozjpeg/vendor/cjpeg
Reason: image not found
at Promise.all.then.arr (/Users/Luke/Desktop/Sites/New Formula One Autocentres/node_modules/execa/index.js:201:11)
at process._tickCallback (internal/process/next_tick.js:103:7)
@ ./~/css-loader?{"url":true,"sourceMap":false}!./~/postcss-loader?{"sourceMap":false}!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?{"precision":8,"outputStyle":"expanded","sourceMap":true}!./resources/assets/scss/app.scss 3:143685-143735
@ ./resources/assets/scss/app.scss
@ multi ./~/laravel-mix/src/mock-entry.js ./resources/assets/scss/app.scss
Whats causing this?
Hmm, I haven't seen this one before. Can you try switching from mix.sass() to mix.standaloneSass()? Does that fix it?
After a big of digging around the net I found this and solved the problem, paths weren't working correctly it appears
mix.options({
processCssUrls: false
});
Usually this is due to specifying your images paths relative to the compiled CSS, rather than your source Sass file.
@lspoor For what its worth, I've also found this happens if mozjpeg doesn't build properly during your initial npm install You may need to install some additional dependencies outside of npm. See here form more: https://github.com/JeffreyWay/laravel-mix/issues/1271#issuecomment-336782702
Most helpful comment
After a big of digging around the net I found this and solved the problem, paths weren't working correctly it appears