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

gatsby-plugin-sharp fails new <site> command #19432

Closed
Uzwername opened this issue Nov 12, 2019 · 3 comments
Closed

gatsby-plugin-sharp fails new <site> command #19432

Uzwername opened this issue Nov 12, 2019 · 3 comments
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting.

Comments

@Uzwername
Copy link

Uzwername commented Nov 12, 2019

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:
#14015
papandreou/node-pngquant#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
@LekoArts LekoArts added the status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. label Nov 13, 2019
@LekoArts
Copy link
Contributor

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:
#16957 (comment)
#1754

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

@Uzwername
Copy link
Author

@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.

@LekoArts
Copy link
Contributor

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting.
Projects
None yet
Development

No branches or pull requests

2 participants