gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.32k forks source link

Add Node v8.11.3 requirement to quick start guides #6658

Closed bep closed 6 years ago

bep commented 6 years ago
▶ npm -v && uname -a
5.6.0
Darwin MacBook-Pro.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
 gatsby@2.0.0-beta.55
~/dev/dump
▶ gatsby new my-blog https://github.com/gatsbyjs/gatsby-starter-blog\#v2
info Creating new site from git: https://github.com/gatsbyjs/gatsby-starter-blog.git
Cloning into 'my-blog'...
remote: Counting objects: 1064, done.
remote: Total 1064 (delta 0), reused 0 (delta 0), pack-reused 1064
Receiving objects: 100% (1064/1064), 1.84 MiB | 1.61 MiB/s, done.
Resolving deltas: 100% (595/595), done.
success Created starter directory layout
info Installing packages...
yarn install v0.27.5
info No lockfile found.
[1/4] Resolving packages...
warning gatsby-plugin-sharp > imagemin-webp > cwebp-bin > bin-build > download > gulp-decompress > gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/4] ⠂ waiting...
[-/4] ⠂ waiting...
[-/4] ⠂ waiting...
[4/4] ⠂ sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-darwin-x64.tar.gz
error /Users/bep/dev/dump/my-blog/node_modules/sharp: Command failed.
Exit code: 127
Command: sh
Arguments: -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
Directory: /Users/bep/dev/dump/my-blog/node_modules/sharp
Output:
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=9.3.0 runtime=node arch=x64 platform=darwin)
sh: node-gyp: command not found
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error Command failed: yarnpkg
  Error: Command failed: yarnpkg
brotzky commented 6 years ago

sh: node-gyp: command not found

Try updating your node version to latest stable8.11.3 and let us know what happens. https://nodejs.org/en/

bep commented 6 years ago

I downgraded Node from v9.3.0 to 8.11.3 and that builds.

I think this needs a more prominent place in your starter guides.

KyleAMathews commented 6 years ago

It doesn't seem like a node version problem. Just that somehow node-gyp wasn't installed before.

bep commented 6 years ago

It doesn't seem like a node version problem. Just that somehow node-gyp wasn't installed before.

It certainly was a problem with my node installation. I followed your quick start, and it goes right into "npm install ...". It would make it easier for the end user if you added a note about prerequisite requirements (Node v?)

KyleAMathews commented 6 years ago

Node 9 should work afaik is what I mean. Would you mind switching back to node 9 and trying again just to double-check?

baukevanderlaan commented 6 years ago

I run Node v 10.7.0 and also encounter problems installing Sharp. Both trying to install the gatsby-starter-blog and a regular npm install sharp gives the same problem of seeming to download Sharp indefinetely.

Edit: I downgraded to Node v8.11.3 but unlike @bep, I still can't install Sharp.

bep commented 6 years ago

Would you mind switching back to node 9 and trying again just to double-check?

Brew doesn't have an (easy) way to install Node 9 anymore. But since @brotzky 's first instinctive response was to try Node 8, it tells me that this isn't the first. I would think that some text about the runtime needed to run Gatsby would be ... useful. And possible also use that/those runtimes in the CI build to verify the setup.

KyleAMathews commented 6 years ago

NPM packages w/ binary dependencies are unfortunately notoriously buggy to install in Node. We get issues around installing sharp every so often and the only fix unfortunately is generally to remove the node_modules directory and try again.

@brotzky's advice wasn't about node 8 vs 9 per se — it was just that something was clearly goofy with your node install. I've used Node 6/7/8/9/10 with Gatsby w/o troubles. We do test on Node 6, 8, and 10.