NickolasDzR
NickolasDzR

Reputation: 67

I got error from gulp - JPEG support not compiled

before this incident i developed without problems. And today i had to reinstall Windows, after that i installed ubuntu terminal on windows. Installed gulp, node, npm(after this error i tried to start project by yarn) When i started my gulp project, tasks did not complete. Problem is that i got error like:

$ gulp
[21:29:30] Requiring external module @babel/register
[21:29:40] Using gulpfile /mnt/c/Users/erasc/OneDrive/Desktop/VorononaPortf/gulpfile.babel.js
[21:29:40] Starting 'default'...
[21:29:40] Starting 'clean'...
[21:29:40] Finished 'clean' after 90 ms
[21:29:40] Starting 'views'...
[21:29:40] Starting 'styles'...
[21:29:40] Starting 'scripts'...
[21:29:40] Starting 'images'...
[21:29:40] Starting 'webp'...
[21:29:40] Starting 'sprites'...
[21:29:40] Starting 'fonts'...
[21:29:40] Starting 'iconfont'...
[21:29:40] Starting 'favicons'...
[21:29:41] Icon fonts 0 items
[21:29:41] Finished 'iconfont' after 583 ms
[21:29:48] 'webp' errored after 8.11 s
[21:29:48] Error in plugin "gulp-webp"
Message:
    JPEG support not compiled. Please install the libjpeg development package before building.
Error! Could not process file /tmp/7662a061-2ccc-4f0c-a937-04daeb3bdde3
Error! Cannot read input picture file '/tmp/7662a061-2ccc-4f0c-a937-04daeb3bdde3'

Details:
    code: 255
    killed: false
    stdout:
    stderr: JPEG support not compiled. Please install the libjpeg development package before building.
Error! Could not process file /tmp/7662a061-2ccc-4f0c-a937-04daeb3bdde3
Error! Cannot read input picture file '/tmp/7662a061-2ccc-4f0c-a937-04daeb3bdde3'

    failed: true
    signal: null
    cmd: /mnt/c/Users/erasc/OneDrive/Desktop/VorononaPortf/node_modules/cwebp-bin/vendor/cwebp -quiet -mt -o /tmp/8521f795-8c3d-4c8b-8170-2dd2b2ff850b /tmp/7662a061-2ccc-4f0c-a937-04daeb3bdde3
    timedOut: false
    fileName: /mnt/c/Users/erasc/OneDrive/Desktop/VorononaPortf/src/img/header/daria-litvinova.jpg
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false

[21:31:37] 'default' errored after 6.58 s
[21:31:37] The following tasks did not complete: views, styles, scripts, images, sprites, fonts, favicons
[21:31:37] Did you forget to signal async completion?
error Command failed with exit code 1.

If delete jpeg image from project, tasks will complete well, and guld will work, but without them. I understand that problem is my jpeg(which were in my project already) waren't compiled, but i dont know why, and what to do in order to fix it.

I tried reinstall package that need for complied jpeg, but it isn't work for me.

And i understand that problem is my jpeg(which were in my project already) wasn't compiled, but i dont know why, and what to do in order to fix it.

Upvotes: 2

Views: 1724

Answers (2)

Ahmed Khan
Ahmed Khan

Reputation: 61

anyone facing issue after installing the packages apt-get install -y libjpeg-dev libpng-dev libtiff-dev libgif-dev libwebp-dev remove your node_modules and reinstall packages, it will work

Upvotes: 0

webdev4422
webdev4422

Reputation: 147

Compiling the Utilities on Unix-like Platforms (Google Developers)

In order for package gulp-webp to work, you need to install appropriate dependencies on Linux machine.

  1. Install packages, needed to convert images

    sudo apt install libjpeg-dev libpng-dev libtiff-dev libgif-dev

  2. Download libwebp-1.2.1.tar.gz from https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html

  3. Untar

    tar xvzf libwebp-1.2.1.tar.gz

  4. Build WebP encoder cwebp and decoder dwebp

    cd libwebp-1.2.1 && ./configure && make && sudo make install

  5. Set environment variable

    echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" >> ~/.bashrc

  6. Reboot

P.S. For me, this does not work on WSL1, but works on WSL2. The workaround is shell script:

for i in *.jpg; do cwebp "$i" -o "${i/.jpg/.webp}"; done

Sources:

https://developers.google.com/speed/webp/docs/compiling#compiling_on_unix-like_platforms https://learn.microsoft.com/en-us/windows/wsl/compare-versions https://askubuntu.com/questions/853814/why-are-webp-utilities-built-on-ubuntu-14-04-not-working-and-showing-a-library-e

Upvotes: 2

Related Questions