SolvedOwlCarousel2 Webpack npm error

I always receive this error whenever I run npm run dev on my server.

ERROR in ./node_modules/owl.carousel/dist/assets/owl.video.play.png
Module build failed: Error: spawn /var/www/blissbox/node_modules/optipng-bin/vendor/optipng ENOENT
    at _errnoException (util.js:1021:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
 @ ./node_modules/css-loader!./node_modules/owl.carousel/dist/assets/owl.carousel.css 6:3522-3553
 @ ./node_modules/owl.carousel/dist/assets/owl.carousel.css
 @ ./resources/assets/js/frontend/universe.js
 @ multi ./resources/assets/js/frontend/universe.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/weehong/.npm/_logs/2017-10-27T11_05_18_768Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/weehong/.npm/_logs/2017-10-27T11_05_18_900Z-debug.log

May I know what's the issue and how to rectify it?

20 Answers

✔️Accepted Answer

@pascalporedda Just did a fresh installation with the latest version 2.3.2 from npm and added this: $owl-image-path: "~owl.carousel/src/img/"; to the _variables.scss in my project and its working fine. btw I m using Roots stack.

Other Answers:

@nicklee I've just had the same issue.
I had to set the $owl-image-path variable BEFORE the owl scss import.

This is how it works for me:

$owl-image-path: "~owl.carousel/src/img/";
@import '~owl.carousel/src/scss/owl.carousel';
@import '~owl.carousel/src/scss/owl.theme.default';

Path has to be absolute for some reason. Ultimately this worked for me.

$owl-image-path: "/node_modules/owl.carousel/src/img/";