Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors thrown for jpg image #9

Closed
muralikodali opened this issue Jan 28, 2021 · 14 comments
Closed

errors thrown for jpg image #9

muralikodali opened this issue Jan 28, 2021 · 14 comments

Comments

@muralikodali
Copy link

optimizt working well on png images and also producing webp and avif format images.

when it is run on png files, it is throwing following error :

Processing. Please wait...events.js:186
      throw er; // Unhandled 'error' event
      ^

Error: spawn /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim',
  path: '/home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim',
  spawnargs: [
    '--strip-all',
    '--strip-com',
    '--strip-exif',
    '--strip-iptc',
    '--strip-icc',
    '--strip-xmp',
    '--all-progressive',
    '--max=80',
    '--stdin',
    '--stdout'
  ]
}

(sharp:54196): GLib-CRITICAL **: 12:55:23.511: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(sharp:54196): GLib-CRITICAL **: 12:55:23.511: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(sharp:54196): GLib-CRITICAL **: 12:55:23.511: g_hash_table_lookup: assertion 'hash_table != NULL' failed

(sharp:54196): GLib-CRITICAL **: 12:55:23.511: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed

(sharp:54196): GLib-CRITICAL **: 12:55:23.511: g_hash_table_lookup: assertion 'hash_table != NULL' failed
fish: “optimizt dusk.jpg” terminated by signal SIGSEGV (Address boundary error)
@igoradamenko
Copy link
Contributor

Hey!

Would you mind to attach the minimum set of files and the command you run to make it possible to reproduce the error?

Also, please, make sure you're using the latest version of Optimizt (2.4.0).

@muralikodali
Copy link
Author

I have already upgraded optimizt to 2.4.0

pictures attached as zip file

pics.zip

@343dev
Copy link
Contributor

343dev commented Feb 1, 2021

I have already upgraded optimizt to 2.4.0

pictures attached as zip file

pics.zip

Looks like the jpegoptim is not properly installed.

Maybe your OS lacks of required libs to build jpegoptim.
https://github.com/tjko/jpegoptim/blob/master/README#L5-L7.

In order to check this, you need to completely remove Optimizt, reinstall it and provide a log of the installation process.

@muralikodali
Copy link
Author

I am on arch linux. OS provided version of jpegoptim is 1.4.6.2
I have uninstalled OS version and compiled jpegoptim from github repository. but the error output is same.

I have uninstalled optimizt and after cleaning npm cache, i have reinstalled it again. same error repeats again.

log file showing installation process is attached for your reference :

install.log

@343dev
Copy link
Contributor

343dev commented Feb 2, 2021

Optimizt does not depend on system installed jpegoptim.

During the Optimizt installation process, the jpegoptim-bin package should run a postinstall script, which builds the jpegoptim from the source code.

An example of a successful Optimizt installation:

npm -g install @funboxteam/optimizt

/usr/bin/optimizt -> /usr/lib/node_modules/@funboxteam/optimizt/cli.js

> sharp@0.27.1 install /usr/lib/node_modules/@funboxteam/optimizt/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /root/.npm/_libvips/libvips-8.10.5-linux-x64.tar.br

> gif2webp-bin@3.0.1 postinstall /usr/lib/node_modules/@funboxteam/optimizt/node_modules/gif2webp-bin
> node lib/install.js

  ✔ gif2webp pre-build test passed successfully

> gifsicle@5.1.0 postinstall /usr/lib/node_modules/@funboxteam/optimizt/node_modules/gifsicle
> node lib/install.js

  ⚠ Response code 404 (Not Found)
  ⚠ gifsicle pre-build test failed
  ℹ compiling from source
  ✔ gifsicle built successfully

> guetzli@3.0.1 postinstall /usr/lib/node_modules/@funboxteam/optimizt/node_modules/guetzli
> node lib/install.js

  ⚠ Command failed: /usr/lib/node_modules/@funboxteam/optimizt/node_modules/guetzli/vendor/guetzli --verbose
Guetzli JPEG compressor. Usage:
guetzli [flags] input_filename output_filename

Flags:
  --verbose    - Print a verbose trace of all attempts to standard output.
  --quality Q  - Visual quality to aim for, expressed as a JPEG quality value.
  --memlimit M - Memory limit in MB. Guetzli will fail if unable to stay under
                 the limit. Default is 6000 MB
  --nomemlimit - Do not limit memory usage.


  ⚠ guetzli pre-build test failed
  ℹ compiling from source
  ✔ guetzli built successfully

> jpegoptim-bin@6.0.0 postinstall /usr/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin
> node lib/install.js

  ⚠ Command failed: /usr/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim --version
/usr/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory


  ⚠ jpegoptim pre-build test failed
  ℹ compiling from source
  ✔ jpegoptim built successfully

> pngquant-bin@6.0.0 postinstall /usr/lib/node_modules/@funboxteam/optimizt/node_modules/pngquant-bin
> node lib/install.js

  ✔ pngquant pre-build test passed successfully
+ @funboxteam/optimizt@2.4.0
added 402 packages from 362 contributors in 71.283s

as you can see from the log, the postinstall script for jpegoptim-bin was run and jpegoptim was successfully built from source:

> jpegoptim-bin@6.0.0 postinstall /usr/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin
> node lib/install.js

  ⚠ Command failed: /usr/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim --version
/usr/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory


  ⚠ jpegoptim pre-build test failed
  ℹ compiling from source
  ✔ jpegoptim built successfully

if the build fails, the log may look like this:

> jpegoptim-bin@6.0.0 postinstall /home/xxx/.nvm/versions/node/v12.16.3/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin
> node lib/install.js

  ⚠ Command failed: /home/xxx/.nvm/versions/node/v12.16.3/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim --version
/home/xxx/.nvm/versions/node/v12.16.3/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory


  ⚠ jpegoptim pre-build test failed
  ℹ compiling from source
  ✖ Error: Command failed: /bin/sh -c ./configure --prefix="/home/xxx/.nvm/versions/node/v12.16.3/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor" --bindir="/home/xxx/.nvm/versions/node/v12.16.3/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor"

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for jpeg_read_header in -ljpeg... no
Cannot find libjpeg or you have too old version (v6 or later required).

here we can see that it was not possible to build jpegoptim because of the libjpeg library is not found, so we can install libjpeg or libjpeg-turbo in our OS and start the Optimizt installation again.

The log you provided does not contain information about running postinstall scripts, so there is no way to conclude that jpegoptim was installed successfully or not.

Please make sure you don't have postinstall scripts disabled using ignore-scripts.

@343dev
Copy link
Contributor

343dev commented Feb 2, 2021

Error: spawn /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim ENOENT

Does the file really exist? If so, does it have permissions to run?
What happens if you try to run this file directly from terminal?

@muralikodali
Copy link
Author

/home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin/vendor/jpegoptim - this file doesn't exist.

/home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin
contains following file structure :

.
├── cli.js
├── index.js
├── lib
│   ├── index.js
│   └── install.js
├── license
├── package.json
└── readme.md

@343dev
Copy link
Contributor

343dev commented Feb 2, 2021

OK, now we know for sure that jpegoptim was not built from source during the Optimizt installation.

In order to understand why this happened, we need the postinstall script log like here: #9 (comment)

@muralikodali
Copy link
Author

libjpeg-turbo 2.0.6-1 was installed
I have provided complete log of installation. i don't know why post install scripts were not running ?

@343dev
Copy link
Contributor

343dev commented Feb 2, 2021

Please make sure you don't have postinstall scripts disabled using ignore-scripts.

Maybe you have ignore-scripts=true in your .npmrc file?

Please try this:

npm -g uninstall @funboxteam/optimizt
npm config set ignore-scripts false
npm -g install @funboxteam/optimizt

@muralikodali
Copy link
Author

Thanks for your suggestion.
I have built successfully with "npm config set ignore-scripts false".

log is produced as shown below :

/home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/bin/optimizt -> /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/cli.js

> sharp@0.27.1 install /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /home/murali/.npm/_libvips/libvips-8.10.5-linux-x64.tar.br

> gif2webp-bin@3.0.1 postinstall /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/gif2webp-bin
> node lib/install.js

  ✔ gif2webp pre-build test passed successfully

> gifsicle@5.1.0 postinstall /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/gifsicle
> node lib/install.js

  ⚠ Response code 404 (Not Found)
  ⚠ gifsicle pre-build test failed
  ℹ compiling from source
  ✔ gifsicle built successfully

> guetzli@3.0.1 postinstall /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/guetzli
> node lib/install.js

  ⚠ Command failed: /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/guetzli/vendor/guetzli --verbose
Guetzli JPEG compressor. Usage:
guetzli [flags] input_filename output_filename

Flags:
  --verbose    - Print a verbose trace of all attempts to standard output.
  --quality Q  - Visual quality to aim for, expressed as a JPEG quality value.
  --memlimit M - Memory limit in MB. Guetzli will fail if unable to stay under
                 the limit. Default is 6000 MB
  --nomemlimit - Do not limit memory usage.


  ⚠ guetzli pre-build test failed
  ℹ compiling from source
  ✔ guetzli built successfully

> jpegoptim-bin@6.0.0 postinstall /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/jpegoptim-bin
> node lib/install.js

  ✔ jpegoptim pre-build test passed successfully

> pngquant-bin@6.0.0 postinstall /home/zenova/projects/nvm/.nvm/versions/node/v12.9.1/lib/node_modules/@funboxteam/optimizt/node_modules/pngquant-bin
> node lib/install.js

  ✔ pngquant pre-build test passed successfully
+ @funboxteam/optimizt@2.4.0
added 402 packages from 362 contributors in 52.679s

@343dev
Copy link
Contributor

343dev commented Feb 2, 2021

Good, i see no errors here. So i guess it works now?

@muralikodali
Copy link
Author

it works without errors.
Thanks again

@343dev
Copy link
Contributor

343dev commented Feb 2, 2021

You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants