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

"spawn Unknown system error -8" when using Docker #357

Open
xshapira opened this issue Aug 23, 2021 · 0 comments
Open

"spawn Unknown system error -8" when using Docker #357

xshapira opened this issue Aug 23, 2021 · 0 comments

Comments

@xshapira
Copy link

xshapira commented Aug 23, 2021

On my macOS I don't seem to have any issue, but when using Docker I get this output:

node_1      | [08:16:41] Finished 'clean' after 23 ms
node_1      | [08:16:41] Starting 'scripts'...
node_1      | [08:16:41] Starting 'styles'...
node_1      | [08:16:41] Starting 'images'...
node_1      | [08:16:41] Starting 'html'...
node_1      | ℹ - [Scripts] Compiling...
node_1      | ℹ - [Styles] Compiling...
node_1      | ℹ - [Images] Optimizing...
node_1      | ℹ - [HTML] Compiling...
node_1      | [08:16:58] 'images' errored after 17 s
node_1      | [08:16:58] Error in plugin "gulp-imagemin"
node_1      | Message:
node_1      |     spawn Unknown system error -8
node_1      | Details:
node_1      |     errno: -8
node_1      |     code: Unknown system error -8
node_1      |     syscall: spawn
node_1      |     fileName: /usr/src/app/assets/img/about-01.jpg
node_1      |     domainEmitter: [object Object]
node_1      |     domainThrown: false
node_1      | 
node_1      | [08:16:58] 'build' errored after 17 s
node_1      | npm ERR! code ELIFECYCLE
node_1      | npm ERR! errno 1
node_1      | npm ERR! @ dev: `gulp build && gulp watch`
node_1      | npm ERR! Exit status 1
node_1      | npm ERR! 
node_1      | npm ERR! Failed at the @ dev script.
node_1      | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
node_1      | 
node_1      | npm ERR! A complete log of this run can be found in:
node_1      | npm ERR!     /root/.npm/_logs/2021-08-22T08_16_58_562Z-debug.log
node_1 exited with code 1

My Dockerfile:

FROM node:14-alpine3.11

WORKDIR /usr/src/app

COPY ./app/package.json /usr/src/app

RUN  apk --update --no-cache \
	add  \
        automake \
	git \
	alpine-sdk  \
	nasm  \
	autoconf  \
	build-base \
	zlib \
	zlib-dev \
	libpng \
	libpng-dev\
	libwebp \
	libwebp-dev \
	libjpeg-turbo \
	libjpeg-turbo-dev \
        # mozjpeg: the packages above allowing to compile the binaries
        && rm -rf /var/lib/apt/lists/*

RUN npm install -g gulp \
    && npm install gulp

ENV PATH ./node_modules/.bin/:$PATH

gulpfile

import imagemin, { gifsicle, mozjpeg, optipng, svgo } from 'gulp-imagemin';

const imageminMozjpeg = require('imagemin-mozjpeg');

gulp.task('images', () => {
  logger('[Images] Optimizing...');
  return gulp
    .src(`${options.paths.src.img}/**/*.*`)
    .pipe(
      imagemin(
        [
          gifsicle({ interlaced: true }),
          imageminMozjpeg({ quality: 80, progressive: true }),
          optipng({ optimizationLevel: 5 }),
          svgo({ plugins: [{ removeViewBox: true }, { cleanupIDs: false }] }),
        ],
        {
          silent: false,
        }
      )
    )
    .pipe(
      isProd
        ? gulp.dest(options.paths.build.img)
        : gulp.dest(options.paths.dist.img)
    )
    .on('end', () => logger('[Images] Success!', figures.tick, 'GREEN'))
    .on('error', () => logger('[Images] Failed', figures.cross, 'RED'));
});

package.json

{
"devDependencies": {
"gulp-imagemin": "^8.0.0",
"imagemin-mozjpeg": "^6.0.0"
  }
}

I cleaned cache, ran npm i again but nothing helps. Earlier, I fixed this issue: mozjpeg/vendor/cjpeg` binary doesn't seem to work correctlyhttps://github.com/imagemin/imagemin-mozjpeg/issues/28

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

1 participant