Gatsby: macOS El Capitan :: gatsby develop :: "Illegal instruction: 4"

Created on 28 Oct 2018  ยท  5Comments  ยท  Source: gatsbyjs/gatsby

Description

Hi there, i'm trying out Gatsby in my personal macOS system. However when running gatsby develop or gatsby build I run into the following error:

success open and validate gatsby-config โ€” 0.010 s
success load plugins โ€” 0.491 s
โ  Illegal instruction: 4

I was able to drill down the root cause to the gatsby-transformer-sharp which depends on the sharp lib. After a bit of investigation I found this thread which seems to be related to this issue: https://github.com/lovell/sharp/issues/1402

A suggested workaround is this: https://github.com/lovell/sharp/issues/1402#issuecomment-428639785 which I've tried with no success, because I run into a new problem which is being unable to install vips using homebrew:

$ brew install vips --build-from-source

==> Installing dependencies for vips: python@2, gobject-introspection, cmake, rust, libtiff, gdk-pixbuf, libcroco, fribidi, graphite2, harfbuzz, pango, librsvg, little-cms2, orc, webp, gmp, isl, mpfr, libmpc, gcc, fftw, jasper, libtool, graphicsmagick, nspr, nss, openjpeg and poppler
==> Installing vips dependency: python@2
==> Downloading https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz

curl: (35) Unknown SSL protocol error in connection to www.python.org:-36
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "python@2"
Download failed: https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz

In this case it seems that Python 2.7.15 is no longer supported for OSX El Capitan (no homebrew bottle for this OS): https://formulae.brew.sh/formula/python@2

I'm just posting this to find out if:

  1. Is there any alternative to get Gatsby to work with OSX El Capitan using gatsby-transformer-sharp
  2. ... or to be able to install vips using homebrew.

Appreciate any help that you can provide!

Steps to reproduce

  1. Run gatsby develop in OSX El Capitan, you'll get the aforementioned error;

  2. Commenting gatsby-transformer-sharp in gatsby-config.js and removing Image component from image.js no longer throws the error.

Environment

  System:
    OS: OS X El Capitan 10.11.6
    CPU: x64 Intel(R) Core(TM)2 Duo CPU     E8135  @ 2.66GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.6.0 - /usr/local/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 6.1.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 70.0.3538.77
    Firefox: 46.0
    Safari: 11.1.1
  npmPackages:
    gatsby: ^2.0.19 => 2.0.19 
    gatsby-image: ^2.0.15 => 2.0.15 
    gatsby-plugin-manifest: ^2.0.5 => 2.0.5 
    gatsby-plugin-offline: ^2.0.5 => 2.0.5 
    gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0 
    gatsby-plugin-sharp: ^2.0.8 => 2.0.8 
    gatsby-plugin-styled-components: ^3.0.0 => 3.0.0 
    gatsby-source-filesystem: ^2.0.4 => 2.0.4 
    gatsby-transformer-sharp: ^2.1.4 => 2.1.4 
question or discussion

Most helpful comment

@josebrito This has been fixed upstream - see https://github.com/lovell/sharp/issues/1402#issuecomment-435102575

All 5 comments

That's a bummer. ๐Ÿ˜• Have you tried using an older version of gatsby-transformer-sharp? Its sharp dependency seems to have been updated just recently.

Try npm i [email protected] for a temporary fix while waiting for sharp devs to fix the issue! ๐Ÿ™‚

@hexrcs for sure I will try that approach, the thing is I'll be away from that setup for the next 2 weeks, so I won't be able to provide feedback until then. If you could keep this issue open for that period it would be highly appreciated. It would also give someone else the chance to chime in, if that's the case.

On a side note: I am aware that this is an issue with my particular setup, so it will probably affect a very very small number of people. I would probably find a workaround if I updated from El Capitan to a most recent version, however that's not an option due to compatibility constraints of other software running in that machine.

On another note: I've tested Gatsby in an Ubuntu environment and everything worked fine (as it was expected :) ).

Thanks for the feedback!

@josebrito This has been fixed upstream - see https://github.com/lovell/sharp/issues/1402#issuecomment-435102575

Awesome. Thanks @lovell for the fix and noting it here, as well ๐Ÿ’œ

Closing this out, @josebrito feel free to re-open as needed! Thank you!

@DSchau @hexrcs As promised, I'm back to provide some feedback and can confirm that the issue no longer occurs, even in El Capitan.

Thanks guys, hats off to @lovell !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dustinhorton picture dustinhorton  ยท  3Comments

kalinchernev picture kalinchernev  ยท  3Comments

Oppenheimer1 picture Oppenheimer1  ยท  3Comments

timbrandin picture timbrandin  ยท  3Comments

hobochild picture hobochild  ยท  3Comments