mmomtchev / node-gdal-async

Node.js bindings for GDAL (Geospatial Data Abstraction Library) with full async support
https://mmomtchev.github.io/node-gdal-async/
Apache License 2.0
133 stars 26 forks source link

npm install --build-from-source causes large error. #27

Closed tris-g closed 2 years ago

tris-g commented 2 years ago

Hi there, thanks for responding to my issue on Stack Overflow (https://stackoverflow.com/questions/71383334/how-to-use-node-gdal-with-electron/)

When trying to get gdal-async working in Electron and using npm install --build-from-source gdal-async the following happens (please refer to log file).

2022-03-07T15_56_59_053Z-debug.log

Thanks.

tris-g commented 2 years ago

Accidentally closed issue, my apologies.

mmomtchev commented 2 years ago

I confirm that there is a problem with rebuilding on Windows - but you will also have to rebuild in the Electron environment, this is a Node.js build

tris-g commented 2 years ago

I confirm that there is a problem with rebuilding on Windows - but you will also have to rebuild in the Electron environment, this is a Node.js build

Do you know how I can do this? Thanks.

mmomtchev commented 2 years ago

Ok, first of all, grab this file: https://github.com/mmomtchev/node-gdal-async/blob/master/deps/libhdf5/hdf5/src/H5version.h and place it in node_modules/gdal-async/deps/libhdf5/src/H5version.h - it was missing because of a .gitignore - it will be fixed in the next release

mmomtchev commented 2 years ago

Then follow this tutorial: https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules

Also, you should know that gdal doesn't support multiple instances as used by Electron - you will be able to use it only in one instance

mmomtchev commented 2 years ago

This is the command you need

node-pre-gyp rebuild --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers

Run it from node_modules/gdal-async or specify these arguments when doing npm install

tris-g commented 2 years ago

I have tried to follow your instructions to the best of my understanding. However, this error occurred. :(

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--target=17.0.0" "--arch=x64" "--dist-url=https://electronjs.org/headers" "--module=C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\lib\\binding\\node-v102-win32-x64\\gdal.node" "--module_name=gdal" "--module_path=C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\lib\\binding\\node-v102-win32-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v102"
gyp ERR! cwd C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\node-gyp\bin\node-gyp.js build --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers --module=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64\gdal.node --module_name=gdal --module_path=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Windows_NT 10.0.19044
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "rebuild" "--target=17.0.0" "--arch=x64" "--dist-url=https://electronjs.org/headers"
node-pre-gyp ERR! cwd C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async
node-pre-gyp ERR! node -v v16.13.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.8
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\node-gyp\bin\node-gyp.js build --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers --module=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64\gdal.node --module_name=gdal --module_path=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)

Thanks for your continual help.

mmomtchev commented 2 years ago

Is this everything? Nothing before this?

tris-g commented 2 years ago

npm install gdal-async --save --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers gives me the following error. npm ERR! node-pre-gyp ERR! stack Error: Unsupported target version: 17.0.0 check log for details. 2022-03-08T11_37_42_743Z-debug.log

mmomtchev commented 2 years ago

Which version of Electron are you using? 17?

mmomtchev commented 2 years ago

By the way, until 3.4.2 gets released, which will be in the next few days, you won't have a choice, you will have to manually add the H5version.h file, so you won't be able to build-install in one single command.

As far as I am aware, you are the very first Electron user, so expect some rough edges.

For now, install normally, then launch the build command in node_modules/gdal-async.

tris-g commented 2 years ago

By the way, until 3.4.2 gets released, which will be in the next few days, you won't have a choice, you will have to manually add the H5version.h file, so you won't be able to build-install in one single command.

As far as I am aware, you are the very first Electron user, so expect some rough edges.

For now, install normally, then launch the build command in node_modules/gdal-async.

I tried the build command here. node-pre-gyp rebuild --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers in node_modules/gdal_async giving this error after alot of other text.

I have tried to follow your instructions to the best of my understanding. However, this error occurred. :(

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--target=17.0.0" "--arch=x64" "--dist-url=https://electronjs.org/headers" "--module=C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\lib\\binding\\node-v102-win32-x64\\gdal.node" "--module_name=gdal" "--module_path=C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\lib\\binding\\node-v102-win32-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v102"
gyp ERR! cwd C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\node-gyp\bin\node-gyp.js build --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers --module=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64\gdal.node --module_name=gdal --module_path=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Windows_NT 10.0.19044
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "rebuild" "--target=17.0.0" "--arch=x64" "--dist-url=https://electronjs.org/headers"
node-pre-gyp ERR! cwd C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async
node-pre-gyp ERR! node -v v16.13.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.8
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\node-gyp\bin\node-gyp.js build --target=17.0.0 --arch=x64 --dist-url=https://electronjs.org/headers --module=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64\gdal.node --module_name=gdal --module_path=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\node-v102-win32-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)

Thanks for your continual help.

mmomtchev commented 2 years ago

The error itself is still missing, did you add the H5version.h file?

tris-g commented 2 years ago
C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async>.\node_modules\.bin\node-pre-gyp rebuild --target=17.1.0 --arch=x64 --dist-url=https://electronjs.org/headers
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.5
node-pre-gyp info using node@16.13.1 | win32 | x64
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack Error: Unsupported target version: 17.1.0
node-pre-gyp ERR! stack     at get_runtime_abi (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\util\versioning.js:173:15)
node-pre-gyp ERR! stack     at Object.module.exports.evaluate (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\util\versioning.js:295:15)
node-pre-gyp ERR! stack     at clean (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\clean.js:16:27)
node-pre-gyp ERR! stack     at Object.self.commands.<computed> [as clean] (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\node-pre-gyp.js:86:37)
node-pre-gyp ERR! stack     at run (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\main.js:81:30)
node-pre-gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:78:11)
node-pre-gyp ERR! System Windows_NT 10.0.19044
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "rebuild" "--target=17.1.0" "--arch=x64" "--dist-url=https://electronjs.org/headers"
node-pre-gyp ERR! cwd C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async
node-pre-gyp ERR! node -v v16.13.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.5

Is what I'm getting, with adding in \src\H5version.h to the correct location.

mmomtchev commented 2 years ago

17.1.0 is not supported even by the latest node-pre-gyp - 17.0.0 is the latest one On the Electron site, there is a tutorial for setting all the variables for node-pre-gyp on Linux, replace export with set for Windows and do this in the gdal-async directory:

export npm_config_target=17.1.0
export npm_config_arch=x64
export npm_config_target_arch=x64
export npm_config_disturl=https://electronjs.org/headers
export npm_config_runtime=electron
export npm_config_build_from_source=true
node-pre-gyp rebuild
tris-g commented 2 years ago

17.1.0 is not supported even by the latest node-pre-gyp - 17.0.0 is the latest one On the Electron site, there is a tutorial for setting all the variables for node-pre-gyp on Linux, replace export with set for Windows and do this in the gdal-async directory:

export npm_config_target=17.1.0
export npm_config_arch=x64
export npm_config_target_arch=x64
export npm_config_disturl=https://electronjs.org/headers
export npm_config_runtime=electron
export npm_config_build_from_source=true
node-pre-gyp rebuild

Tried with 17.0.0

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Tristan\Projects\electron-lir\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--module=C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\lib\\binding\\electron-v17.0-win32-x64\\gdal.node" "--module_name=gdal" "--module_path=C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\lib\\binding\\electron-v17.0-win32-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=electron-v17.0"
gyp ERR! cwd C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Tristan\Projects\electron-lir\node_modules\node-gyp\bin\node-gyp.js build --module=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\electron-v17.0-win32-x64\gdal.node --module_name=gdal --module_path=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\electron-v17.0-win32-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v17.0' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Windows_NT 10.0.19044
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tristan\\Projects\\electron-lir\\node_modules\\gdal-async\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "rebuild"
node-pre-gyp ERR! cwd C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async
node-pre-gyp ERR! node -v v16.13.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.5
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Tristan\Projects\electron-lir\node_modules\node-gyp\bin\node-gyp.js build --module=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\electron-v17.0-win32-x64\gdal.node --module_name=gdal --module_path=C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\lib\binding\electron-v17.0-win32-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v17.0' (1)
mmomtchev commented 2 years ago

The actual build error is earlier than this

tris-g commented 2 years ago

node-pre-gyperroroutput.txt

This is the whole output.

The actual build error is earlier than this

mmomtchev commented 2 years ago
C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\deps\libhdf5\hdf5\src\H5public.h(32,10): fatal error C10
83: Cannot open include file: 'H5version.h': No such file or directory [C:\Users\Tristan\Projects\electron-lir\node_mod
ules\gdal-async\build\deps\libhdf5\libhdf5.vcxproj]

It is still the missing file

tris-g commented 2 years ago
C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\deps\libhdf5\hdf5\src\H5public.h(32,10): fatal error C10
83: Cannot open include file: 'H5version.h': No such file or directory [C:\Users\Tristan\Projects\electron-lir\node_mod
ules\gdal-async\build\deps\libhdf5\libhdf5.vcxproj]

It is still the missing file

image

tris-g commented 2 years ago

Ah, it seems to be in the wrong location. Let me retry.

tris-g commented 2 years ago

It is still failing to execute, the list is too long to copy.

mmomtchev commented 2 years ago

Try to find the first error

tris-g commented 2 years ago

C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\deps\libhdf5\hdf5\src\H5public.h(32,10): fatal error C10 83: Cannot open include file: 'H5version.h': No such file or directory [C:\Users\Tristan\Projects\electron-lir\node_mod ules\gdal-async\build\deps\libhdf5\libhdf5.vcxproj]

mmomtchev commented 2 years ago

Do you have C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\deps\libhdf5\hdf5\src\H5version.h? This is the right location?

tris-g commented 2 years ago

Do you have C:\Users\Tristan\Projects\electron-lir\node_modules\gdal-async\deps\libhdf5\hdf5\src\H5version.h? This is the right location?

Yes, I'm able to view it using that exact path.

mmomtchev commented 2 years ago

Use:

export npm_config_target=17.1.0
export npm_config_arch=x64
export npm_config_target_arch=x64
export npm_config_disturl=https://electronjs.org/headers
export npm_config_runtime=electron
export npm_config_build_from_source=true
npm i --save https://github.com/mmomtchev/node-gdal-async#3.4 --build-from-source

You will install the current git version which has the missing file. I will release 3.4.2 at the same time as GDAL 3.4.2 which already has a release candidate.

tris-g commented 2 years ago

npm i --save https://github.com/mmomtchev/node-gdal-async#3.4 --build-from-source

Attempting the above gives the following error and output (Electron 17.1.0): 2022-03-09T10_43_28_094Z-debug.log

mmomtchev commented 2 years ago

Try

npm cache clean --force
npm install -g npm@latest
tris-g commented 2 years ago

Git error?

2022-03-09T11_33_36_642Z-debug-0.log

mmomtchev commented 2 years ago

:smile:

50 error ssh: connect to host github.com port 22: Connection refused

This is not a problem on your end - unless it is your ISP or your firewall. Retry.

tris-g commented 2 years ago

😄

50 error ssh: connect to host github.com port 22: Connection refused

This is not a problem on your end - unless it is your ISP or your firewall. Retry.

I can't get past this error :(

mmomtchev commented 2 years ago

Can you checkout anything else from Github? This is a network connectivity problem

tris-g commented 2 years ago

Git dep preperation?

2022-03-09T13_39_50_041Z-debug-0.log

mmomtchev commented 2 years ago

Do you have the latest version of npm?

npm --version
tris-g commented 2 years ago

Do you have the latest version of npm?

npm --version

8.5.3

mmomtchev commented 2 years ago

Does it work if you build for Node.js?

Without setting the other environment variables:

npm i --save https://github.com/mmomtchev/node-gdal-async#3.4 --build-from-source
tris-g commented 2 years ago

Does it work if you build for Node.js?

Without setting the other environment variables:

npm i --save https://github.com/mmomtchev/node-gdal-async#3.4 --build-from-source

I think my SSH to Github is still being refused or timing out. HTTPS connection works, and I've tried replacing the global URLs to use HTTPS. However still getting Git connection error. :/

mmomtchev commented 2 years ago

According to the Github status page, all services are up and running, but I am having issues with codecov, so it is possible that something might be failing on their side. I am able to build it with this command both on Linux and Windows. There was a GDAL 3.4.2rc2 yesterday, it will probably get promoted to final tomorrow and I will release 3.4.2 with the missing file

tris-g commented 2 years ago

According to the Github status page, all services are up and running, but I am having issues with codecov, so it is possible that something might be failing on their side. I am able to build it with this command both on Linux and Windows. There was a GDAL 3.4.2rc2 yesterday, it will probably get promoted to final tomorrow and I will release 3.4.2 with the missing file

Thanks so much. Will that allow me to just do npm install gdal-async ?

mmomtchev commented 2 years ago

You will still have to rebuild in the Electron environment - this step is unavoidable for any Node.js addon which has a binary part - unless I ship prebuilt binaries for every Electron release and every platform out there. I am shipping prebuilt binaries for 3 OSes and 4 Node.js versions and this is already a lot - Electron will add three to four times more :smile:

I suggest you probably try first Electron 16.x, since Electron 17 is very recent and most build tools do not support it at the moment - then when you know it works, you can try upgrading to 17.

mmomtchev commented 2 years ago

@tris-g, I just published gdal-async@3.5.0-alpha.2 which contains the fix for this issue, can you please try to build it in the Electron environment so that I can include any eventual additional changes in tomorrows' 3.4.2? You should be able to follow the official guide: https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules gdal-async is a node-pre-gyp module, there is a section about it.

tris-g commented 2 years ago

@tris-g, I just published gdal-async@3.5.0-alpha.2 which contains the fix for this issue, can you please try to build it in the Electron environment so that I can include any eventual additional changes in tomorrows' 3.4.2? You should be able to follow the official guide: https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules gdal-async is a node-pre-gyp module, there is a section about it.

npm i --save gdal-async@3.5.0-alpha.2 --build-from-source with env variables set correctly?

mmomtchev commented 2 years ago

Can you try both? First, for Node.js, without any env values - so that we can be sure your environment is set ok, and then for Electron with the env values?

tris-g commented 2 years ago

For Node.js without env values set. 2022-03-10T16_59_09_216Z-debug-0.log

mmomtchev commented 2 years ago

Here is your problem: https://stackoverflow.com/questions/3898287/c-include-atlbase-h-is-not-found Run the Visual Studio installer and select the checkbox from the screenshot

tris-g commented 2 years ago

Here is your problem: https://stackoverflow.com/questions/3898287/c-include-atlbase-h-is-not-found Run the Visual Studio installer and select the checkbox from the screenshot

Okay that worked without any errors and I can see it using npm list.

tris-g commented 2 years ago

With env variables set for Electron build following error:

2022-03-10T17_54_08_420Z-debug-0.log

mmomtchev commented 2 years ago

Alas, this is an issue between Electron and nan : https://github.com/nodejs/nan/issues/892

I will check if something can be done

mmomtchev commented 2 years ago

I am closing this issue since this problem has been solved, I created a new issue for Electron