prebuild / prebuildify

Create and package prebuilds for native modules
MIT License
198 stars 37 forks source link

Keeps using Node 5.0.0 headers [win64] #29

Closed chrispahm closed 5 years ago

chrispahm commented 5 years ago

This is essentially the same issue as https://github.com/prebuild/prebuildify/issues/28. The proposed fix, which is simply deleting the ~\.node-gyp folder and trying to re-build afterwards, doesn't work for me though.

I'm trying to build including the NAPI header files with the following command

prebuildify --stip --all --napi

which works perfectly fine on macOS. However, on Windows I get the following exception:

fatal error C1083: Cannot open include file: 'node_api.h': No such file or dire
ctory (compiling source file ..\src\main.cc) [C:\Users\pahmeyer\Documents\node-gdx\build\node-gdx.vcxproj]

When I check the console output, I see that it keeps downloading header files for Node 5.0.0, which didn't include the NAPI yet.

gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.15.0 | win32 | x64
gyp http GET https://nodejs.org/dist/v5.0.0/node-v5.0.0-headers.tar.gz
gyp http 200 https://nodejs.org/dist/v5.0.0/node-v5.0.0-headers.tar.gz
gyp http GET https://nodejs.org/dist/v5.0.0/SHASUMS256.txt
gyp http GET https://nodejs.org/dist/v5.0.0/win-x86/node.lib
gyp http GET https://nodejs.org/dist/v5.0.0/win-x64/node.lib
gyp http 200 https://nodejs.org/dist/v5.0.0/win-x64/node.lib
gyp http 200 https://nodejs.org/dist/v5.0.0/win-x86/node.lib
gyp http 200 https://nodejs.org/dist/v5.0.0/SHASUMS256.txt

Checking

node -p process.release

points to the correct header url.

{ name: 'node',
  lts: 'Dubnium',
  sourceUrl:
   'https://nodejs.org/download/release/v10.15.0/node-v10.15.0.tar.gz',
  headersUrl:
   'https://nodejs.org/download/release/v10.15.0/node-v10.15.0-headers.tar.gz',
  libUrl:
   'https://nodejs.org/download/release/v10.15.0/win-x64/node.lib' }

Does anyone have an idea of how this can be fixed? Thanks in advance!

vweevers commented 5 years ago

Don't combine --all with --napi, because --all selects all ABIs, while N-API is meant to be ABI-agnostic. With N-API you typically need only one prebuild (per platform, sometimes also per runtime).

Try either:

vweevers commented 5 years ago

@ralphtheninja @mafintosh Maybe we should throw an informative error on --all --napi? Or give precedence to one of them.

chrispahm commented 5 years ago

Hey @vweevers, Thanks for the clarification! I tried again using

prebuildify --napi --strip

and it succesfully build for the latest node version (12.0.0), but afterwards started to download the 5.0.0 version again and then failed at the second build. Using the -t flag with a single node version worked fine though.

vweevers commented 5 years ago

afterwards started to download the 5.0.0 version again and then failed at the second build.

I see. So Electron@5 is the problem.

vweevers commented 5 years ago

@chrispahm can you share the full log of prebuildify --napi --strip without -t (preferably as a gist)?

chrispahm commented 5 years ago

@vweevers thanks for following up. So I just logged on again after lunch, ran prebuildify --napi --strip and it worked without any issue :) so sorry for the false bug report, and thanks again for the help!