I am trying to setup a new Gatsby project using the default starter template, following the associated documentation. This is the error I'm getting:
jeremy@Jeremys-MacBook-Pro:~/Blog|⇒ gatsby new jeremypuchta-blog
info Creating new site from git: https://github.com/gatsbyjs/gatsby-starter-default.git
Klone nach 'jeremypuchta-blog' ...
remote: Enumerating objects: 54, done.
remote: Counting objects: 100% (54/54), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 1578 (delta 39), reused 35 (delta 20), pack-reused 1524
Empfange Objekte: 100% (1578/1578), 5.71 MiB | 7.25 MiB/s, Fertig.
Löse Unterschiede auf: 100% (954/954), Fertig.
success Created starter directory layout
info Installing packages...
> [email protected] install /Users/jeremy/Blog/jeremypuchta-blog/node_modules/fsevents
> node install
node-pre-gyp WARN Using request for node-pre-gyp https download
[fsevents] Success: "/Users/jeremy/Blog/jeremypuchta-blog/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote
> [email protected] install /Users/jeremy/Blog/jeremypuchta-blog/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /Users/jeremy/.npm/_libvips/libvips-8.7.0-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=12.1.0 runtime=node arch=x64 libc= platform=darwin)
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
In file included from ../src/common.cc:24:
In file included from ../../nan/nan.h:223:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:356:37: error: too few arguments to function call, expected 2, have 1
return v8::StringObject::New(value).As<v8::StringObject>();
~~~~~~~~~~~~~~~~~~~~~ ^
/Users/jeremy/.node-gyp/12.1.0/include/node/v8.h:5380:3: note: 'New' declared here
static Local<Value> New(Isolate* isolate, Local<String> value);
^
In file included from ../src/common.cc:24:
In file included from ../../nan/nan.h:223:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:356:58: error: expected '(' for function-style cast or type construction
return v8::StringObject::New(value).As<v8::StringObject>();
~~~~~~~~~~~~~~~~^
../../nan/nan_implementation_12_inl.h:356:60: error: expected expression
return v8::StringObject::New(value).As<v8::StringObject>();
^
In file included from ../src/common.cc:24:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
assert(persistent().IsNearDeath());
~~~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro
'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
^
In file included from ../src/common.cc:24:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:127:26: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
assert(wrap->handle_.IsNearDeath());
~~~~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/assert.h:93:25: note: expanded from macro
'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
^
In file included from ../src/common.cc:27:
../src/common.h:78:20: error: no member named 'Handle' in namespace 'v8'
bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
~~~~^
../src/common.h:78:37: error: expected '(' for function-style cast or type construction
bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
~~~~~~~~~~^
../src/common.h:78:39: error: use of undeclared identifier 'obj'
bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
^
../src/common.h:78:56: error: expected '(' for function-style cast or type construction
bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
~~~~~~~~~~~ ^
../src/common.h:79:29: error: no member named 'Handle' in namespace 'v8'
std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
~~~~^
../src/common.h:79:46: error: expected '(' for function-style cast or type construction
std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
~~~~~~~~~~^
../src/common.h:79:48: error: use of undeclared identifier 'obj'
std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
^
../src/common.h:79:65: error: expected '(' for function-style cast or type construction
std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
~~~~~~~~~~~ ^
../src/common.h:80:38: error: no member named 'Handle' in namespace 'v8'
std::vector<double> AttrAsRgba(v8::Handle<v8::Object> obj, std::string attr);
~~~~^
../src/common.h:80:55: error: expected '(' for function-style cast or type construction
std::vector<double> AttrAsRgba(v8::Handle<v8::Object> obj, std::string attr);
~~~~~~~~~~^
../src/common.h:80:57: error: use of undeclared identifier 'obj'
std::vector<double> AttrAsRgba(v8::Handle<v8::Object> obj, std::string attr);
^
../src/common.h:80:74: error: expected '(' for function-style cast or type construction
std::vector<double> AttrAsRgba(v8::Handle<v8::Object> obj, std::string attr);
~~~~~~~~~~~ ^
../src/common.h:81:37: warning: variable templates are a C++14 extension [-Wc++14-extensions]
template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
^
../src/common.h:81:48: error: no member named 'Handle' in namespace 'v8'
template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
~~~~^
../src/common.h:81:65: error: expected '(' for function-style cast or type construction
template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:196:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/Cellar/node/12.1.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jeremy/Blog/jeremypuchta-blog/node_modules/sharp
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jeremy/.npm/_logs/2019-05-01T18_35_38_662Z-debug.log
error Command failed: npm install
Error: Command failed: npm install
- index.js:236
[lib]/[gatsby-cli]/[execa]/index.js:236:11
- task_queues.js:89 processTicksAndRejections
internal/process/task_queues.js:89:5
I already tried a couple of things I found here and on other forums concerning similar issues. What I need to mention is, that I am able to setup _gatsby-starter-hello-world_ without any problems. This problems occurs with _gatsby-starter-default_ and _gatsby-starter-blog_.
I reinstalled Node entirely from scratch via Homebrew and installed the Gatsby-CLI globally new as well. Furthermore I checked my XCode-Installation and can not see any issues with that.
An other user on Stackoverflow reported a very similar issue to mine a couple of hours ago, which you can find here.
Following the commands from the Quick Start Guide.
Gatsby project is setup properly and gatsby develop is starting the development environment under localhost:8000
Executing gatsby new <my-gatsby-site> results in the error shown above.
System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.1.0 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 73.0.3683.103
Safari: 12.1
npmGlobalPackages:
gatsby-cli: 2.5.12
Well this is unfortunate!
We use slightly older versions of sharp in our packages that depend upon sharp, e.g. ^0.21.3. This will not grab the latest version of packages, e.g. ^0.22.1, which appears to correctly compile with Node 12.

So, two solutions here:
Sorry for the frustration here--thanks!
And a 3rd solution from @pieh if a yarn user. Use the resolutions feature in yarn in your package.json:
{
"resolutions": {
"sharp": "0.22.1"
}
}
Thank you @DSchau for your quick reply. I've setup NVM to managing multiple Node versions. Now using the latest LTS-Version of Node and everything works fine.
And a 3rd solution from @pieh if a yarn user. Use the
resolutionsfeature in yarn in your package.json:{ "resolutions": { "sharp": "0.22.1" } }
Just want to mention that I attempted this to resolve this issue for myself and was able to successfully yarn install. However, when running gatsby develop I get the following error:
clonedPipeline.resize(...).crop is not a function
Preventing me from building and developing locally 😢
Most helpful comment
And a 3rd solution from @pieh if a yarn user. Use the
resolutionsfeature in yarn in your package.json: