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

Node.js x64 required for starters that use sharp #2311

Closed
ghost opened this issue Oct 2, 2017 · 6 comments
Closed

Node.js x64 required for starters that use sharp #2311

ghost opened this issue Oct 2, 2017 · 6 comments
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@ghost
Copy link

ghost commented Oct 2, 2017

Until I installed an x64 build of Node.js, I kept getting the following error when using any starter that included sharp as a dependency.

I'm just leaving this here for other users to find, please feel free to close it immediately.

Perhaps the gatsby-starters page could note that x64 node might be required or maybe just a general note about native dependencies. (In this particular case, the sharp error states that Intel Architecture 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/.)

This happened to me on Windows 10 x64 with Node.js x86 (v6.11.3) installed...

Example:

> gatsby new gatstrap https://github.com/jaxx2104/gatsby-starter-bootstrap

2017-10-02T14:44:24-0400 <log> init-starter.js:107 (clone) Cloning git repo git://github.com/jaxx2104/gatsby-starter-bootstrap.git to gatstrap...
2017-10-02T14:44:26-0400 <log> init-starter.js:114 () Created starter directory layout
2017-10-02T14:44:26-0400 <log> init-starter.js:44 (install) Installing packages...
yarn install v0.27.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

2017-10-02T14:44:48-0400 <error> new.js:12 () Error: warning gatsby > babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
warning fsevents@1.1.2: The platform "win32" is incompatible with this module.
warning "bootstrap@4.0.0-beta" has unmet peer dependency "jquery@>=3.0.0".
warning "bootstrap@4.0.0-beta" has unmet peer dependency "popper.js@^1.11.0".
error D:\lab\gatsby\gatstrap\node_modules\sharp: Command failed.
Exit code: 1
Command: C:\WINDOWS\system32\cmd.exe
Arguments: /d /s /c node-gyp rebuild
Directory: D:\lab\gatsby\gatstrap\node_modules\sharp
Output:
D:\lab\gatsby\gatstrap\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@6.11.3 | win32 | ia32
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\lab\\gatsby\\gatstrap\\node_modules\\sharp\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Wayne\\.node-gyp\\6.11.3\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Wayne\\.node-gyp\\6.11.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Wayne\\.node-gyp\\6.11.3\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\lab\\gatsby\\gatstrap\\node_modules\\sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\lab\\gatsby\\gatstrap\\node_modules\\sharp\\build',
gyp info spawn args   '-Goutput_dir=.' ]
ERROR: Intel Architecture 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/
gyp: Call to 'node -e "require('./binding').download_vips()"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\lab\gatsby\gatstrap\node_modules\sharp
gyp ERR! node -v v6.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

    at C:\Users\Wayne\AppData\Roaming\npm\node_modules\gatsby-cli\init-starter.js:52:16
    at ChildProcess.exithandler (child_process.js:205:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:920:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
@sebastienfi sebastienfi added API/Plugins type: documentation An issue or pull request for improving or updating Gatsby's documentation labels Oct 2, 2017
@KyleAMathews
Copy link
Contributor

So if this is a requirement we should add that here: https://www.gatsbyjs.org/docs/gatsby-on-windows/

Maybe the getting started instructions too could have a link to the windows. Huh, we could actually check the the OS of the visitor and throw up a big warning just for Windows people.

@KyleAMathews
Copy link
Contributor

How common is 32-bit these days in Windows? I thought 32-bit had disappeared ages ago…

@ghost
Copy link
Author

ghost commented Oct 2, 2017

Node.js still releases 32-bit builds for non-Mac platforms.

I was running 32-bit Node on 64-bit Windows because a long while ago (years), certain native Node modules seemed to have an issue with 64-bit Node on Windows.

Today I switched away from 32-bit Node and I bet there aren't many others running 32-bit, but I don't know.

@ghost
Copy link
Author

ghost commented Oct 2, 2017

However, in the case of sharp, I believe that 32-bit Node on any platform will fail - not just Windows.

For evidence of this, search for 32-bit on this page - http://sharp.dimens.io/en/stable/install/

@geyang
Copy link

geyang commented Dec 19, 2017

I'm using 64-bit node, but still encounter this same error.

@CanRau
Copy link
Contributor

CanRau commented Apr 3, 2018

not sure if i get the same error right now but i sometimes have to npm rebuild sharp after module installations to get it working again, i'll post it when it comes up again

KyleAMathews added a commit that referenced this issue Jun 27, 2018
Update gatsby-on-windows to include mention that Node x64 is a requirement for Sharp fixes #2311
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

No branches or pull requests

5 participants