kavu / webp-loader

WebP image loader & converter for Webpack
MIT License
93 stars 17 forks source link

Build errors on webpack with NextJS #21

Closed ganobrega closed 3 years ago

ganobrega commented 3 years ago
$ next build
Loaded env from /home/ubuntu/repositories/ecommerce/.env
info  - Using external babel configuration from /home/ubuntu/repositories/ecommerce/.babelrc
info  - Creating an optimized production build 
Failed to compile.

./src/assets/images/home/abcde.jpg?webp
Error: /home/ubuntu/repositories/ecommerce/node_modules/cwebp-bin/vendor/cwebp: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
    at runMicrotasks (<anonymous>)

> Build error occurred
Error: > Build failed because of webpack errors
    at /home/ubuntu/repositories/ecommerce/node_modules/next/dist/build/index.js:15:918
    at async /home/ubuntu/repositories/ecommerce/node_modules/next/dist/build/tracer.js:1:525
error Command failed with exit code 1.
kavu commented 3 years ago

Actually, it looks like not a problem with webp-loader itself, but cwebp-bin dependency. I think you are missing some dependency. You may try the possible solution, mentioned in this issue https://github.com/imagemin/cwebp-bin/issues/31

xstable commented 3 years ago

You need to install webp at your server. For Ubuntu you can do apt install webp this installs all the needed dependencies.

kavu commented 3 years ago

You need to install webp at your server. For Ubuntu you can do apt install webp this installs all the needed dependencies.

@ganobrega please, refer to this possible solution.

Thank you, @xstable