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.
Since I don't know why exactly this error happens, I cannot reproduce it, sorry.
my-site should be configured & built
2 errors were thrown. Initial configuration failed.
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
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:
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
softwareupdate -i -a
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
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).
Install the whole bunch of libraries & configs that smart folk recommend you to have:
brew install libtool automake autoconf nasm libpng pkg-config
Re-start terminal.
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!
Most helpful comment
@LekoArts Thank you so much! Can't believe it finally works!
Below is the solution that worked for me:
What you actually need to do is to fetch data from GitHub first and then to run downloaded local file, like this:
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).Install the whole bunch of libraries & configs that smart folk recommend you to have:
Re-start terminal.
Make sure you have last version of gatsby-cli, keep your fingers crossed and run:
Something nice should happen.