gatsby-plugin-sharp fails new <site> command

Created on 12 Nov 2019  Â·  3Comments  Â·  Source: gatsbyjs/gatsby

Description

gatsby new my-site fails trying to install gatsby-plugin-sharp. Without this dependency, the command works correctly. This makes it impossible for me to set-up a project with gatsby-starter-default or any starter based upon it.

2 main errors thrown are:

> [email protected] postinstall /Users/%username%/Desktop/my-site/node_modules/mozjpeg
> node lib/install.js

  âš  self signed certificate
  âš  mozjpeg pre-build test failed
  ℹ compiling from source
  ✖ Error: Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: command not found


    at /Users/%username%/Desktop/my-site/node_modules/execa/index.js:231:11
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 0)

> [email protected] postinstall /Users/%username%/Desktop/my-site/node_modules/pngquant-bin
> node lib/install.js

  âš  self signed certificate
  âš  pngquant pre-build test failed
  ℹ compiling from source
  ✖ Error: pngquant failed to build, make sure that libpng is installed
    at /Users/%username%/Desktop/my-site/node_modules/execa/index.js:231:11
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 0)

I've followed the tutorial and have Node (not installed via homebrew but fully-functional), Xcode Command Line Tools & git installed.

Following the error message, I've also installed libpng which didn't produce any effect.

There are plenty of similar issues like:
https://github.com/gatsbyjs/gatsby/issues/14015
https://github.com/papandreou/node-pngquant/issues/14

But none of them worked for me. 2 days ago the same command produced the expected result & initial configuration passed successfully. From that moment no significant events occurred in environment.

Steps to reproduce

Since I don't know why exactly this error happens, I cannot reproduce it, sorry.

Expected result

my-site should be configured & built

Actual result

2 errors were thrown. Initial configuration failed.

Environment

  System:
    OS: macOS 10.15.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.13.0 - /usr/local/bin/node
    npm: 6.13.0 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 78.0.3904.97
    Safari: 13.0.3
  npmGlobalPackages:
    gatsby-cli: 2.8.9
needs reproduction

Most helpful comment

@LekoArts Thank you so much! Can't believe it finally works!

Below is the solution that worked for me:

  1. Followed this, deleted CommandLineTools, re-installed again & updated them. The sequence was something like:
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
softwareupdate -i -a
  1. Installed Homebrew. If you are in Spain (I happened to be) installation instructions will not work and whatever you do, curl will throw either 60 (self-signed certificate) or 404 since whole https://raw.githubusercontent.com/ seems to be blocked because of unknown reason.

What you actually need to do is to fetch data from GitHub first and then to run downloaded local file, like this:

mkdir brew
cd brew
git clone https://github.com/Homebrew/install.git .
ruby install
  1. You might need to install nvm with brew install nvm & re-start terminal. Since you might need to downgrade the node (I had to downgrade from stable to 8.11.3 for another project).

  2. Install the whole bunch of libraries & configs that smart folk recommend you to have:

brew install libtool automake autoconf nasm libpng pkg-config
  1. Re-start terminal.

  2. Make sure you have last version of gatsby-cli, keep your fingers crossed and run:

gatsby new my-awesome-site

Something nice should happen.

All 3 comments

Hi!

Please make sure that you have everything necessary for node-gyp installed: https://github.com/nodejs/node-gyp#on-macos

Especially this part: https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

Also have a look at these issues:
https://github.com/gatsbyjs/gatsby/issues/16957#issuecomment-528758659
https://github.com/gatsbyjs/gatsby/issues/1754

Your installation might be falsy, please try things like removing libvips version, rebuilding it, re-installing things.

@LekoArts Thank you so much! Can't believe it finally works!

Below is the solution that worked for me:

  1. Followed this, deleted CommandLineTools, re-installed again & updated them. The sequence was something like:
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
softwareupdate -i -a
  1. Installed Homebrew. If you are in Spain (I happened to be) installation instructions will not work and whatever you do, curl will throw either 60 (self-signed certificate) or 404 since whole https://raw.githubusercontent.com/ seems to be blocked because of unknown reason.

What you actually need to do is to fetch data from GitHub first and then to run downloaded local file, like this:

mkdir brew
cd brew
git clone https://github.com/Homebrew/install.git .
ruby install
  1. You might need to install nvm with brew install nvm & re-start terminal. Since you might need to downgrade the node (I had to downgrade from stable to 8.11.3 for another project).

  2. Install the whole bunch of libraries & configs that smart folk recommend you to have:

brew install libtool automake autoconf nasm libpng pkg-config
  1. Re-start terminal.

  2. Make sure you have last version of gatsby-cli, keep your fingers crossed and run:

gatsby new my-awesome-site

Something nice should happen.

Great!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benstr picture benstr  Â·  3Comments

signalwerk picture signalwerk  Â·  3Comments

hobochild picture hobochild  Â·  3Comments

rossPatton picture rossPatton  Â·  3Comments

theduke picture theduke  Â·  3Comments