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

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

Closed
tris-g opened this issue Mar 7, 2022 · 54 comments
Closed

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

tris-g opened this issue Mar 7, 2022 · 54 comments
Labels
bug Something isn't working

Comments

@tris-g
Copy link

tris-g commented Mar 7, 2022

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 tris-g closed this as completed Mar 7, 2022
@tris-g tris-g reopened this Mar 7, 2022
@tris-g
Copy link
Author

tris-g commented Mar 7, 2022

Accidentally closed issue, my apologies.

@mmomtchev mmomtchev added the bug Something isn't working label Mar 7, 2022
@mmomtchev
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 7, 2022

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 added a commit that referenced this issue Mar 7, 2022
@mmomtchev
Copy link
Owner

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
Copy link
Owner

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 added a commit that referenced this issue Mar 7, 2022
@mmomtchev
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 8, 2022

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
Copy link
Owner

Is this everything? Nothing before this?

@tris-g
Copy link
Author

tris-g commented Mar 8, 2022

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
Copy link
Owner

Which version of Electron are you using? 17?

@mmomtchev
Copy link
Owner

mmomtchev commented Mar 8, 2022

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
Copy link
Author

tris-g commented Mar 8, 2022

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
Copy link
Owner

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

mmomtchev added a commit that referenced this issue Mar 8, 2022
mmomtchev added a commit that referenced this issue Mar 8, 2022
@tris-g
Copy link
Author

tris-g commented Mar 8, 2022

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 [email protected]
node-pre-gyp info using [email protected] | 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
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 8, 2022

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
Copy link
Owner

The actual build error is earlier than this

@tris-g
Copy link
Author

tris-g commented Mar 8, 2022

node-pre-gyperroroutput.txt

This is the whole output.

The actual build error is earlier than this

@mmomtchev
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 8, 2022

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
Copy link
Author

tris-g commented Mar 8, 2022

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

@tris-g
Copy link
Author

tris-g commented Mar 8, 2022

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

@mmomtchev
Copy link
Owner

Try to find the first error

mmomtchev added a commit that referenced this issue Mar 8, 2022
@tris-g
Copy link
Author

tris-g commented Mar 9, 2022

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
Copy link
Owner

Try

npm cache clean --force
npm install -g npm@latest

@tris-g
Copy link
Author

tris-g commented Mar 9, 2022

Git error?

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

@mmomtchev
Copy link
Owner

😄

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
Copy link
Author

tris-g commented Mar 9, 2022

😄

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
Copy link
Owner

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

@tris-g
Copy link
Author

tris-g commented Mar 9, 2022

Git dep preperation?

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

@mmomtchev
Copy link
Owner

Do you have the latest version of npm?

npm --version

@tris-g
Copy link
Author

tris-g commented Mar 9, 2022

Do you have the latest version of npm?

npm --version

8.5.3

@mmomtchev
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 9, 2022

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
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 10, 2022

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
Copy link
Owner

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 😄

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
Copy link
Owner

@tris-g, I just published [email protected] 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
Copy link
Author

tris-g commented Mar 10, 2022

@tris-g, I just published [email protected] 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 [email protected] --build-from-source with env variables set correctly?

@mmomtchev
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 10, 2022

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

@mmomtchev
Copy link
Owner

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
Copy link
Author

tris-g commented Mar 10, 2022

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
Copy link
Author

tris-g commented Mar 10, 2022

With env variables set for Electron build following error:

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

@mmomtchev
Copy link
Owner

Alas, this is an issue between Electron and nan : nodejs/nan#892

I will check if something can be done

mmomtchev added a commit that referenced this issue Mar 10, 2022
@mmomtchev
Copy link
Owner

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

@tris-g
Copy link
Author

tris-g commented Mar 10, 2022

Thanks for your effort on this @mmomtchev :)

@tris-g
Copy link
Author

tris-g commented Mar 10, 2022

Is there anything I can do about the nan issue or am I stuck?

@mmomtchev
Copy link
Owner

Not on Windows, there is a very important API call which is missing on Electron - I am checking with them to see why - but from what I saw, other module authors reimplemented it themselves and it has been like this for the last 6 months or so.
There is also the zlib mess which needs sorting out - because GDAL simply requires zlib. I got Linux working. Depending on what remains to be done on Windows, it could happen on the 3.4 branch, or if there is a lot of work, I am afraid it will be for the 3.5 branch.

@mmomtchev
Copy link
Owner

#28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants