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

Using node-gdal in electron #281

Open
oliTF opened this issue Apr 21, 2021 · 4 comments
Open

Using node-gdal in electron #281

oliTF opened this issue Apr 21, 2021 · 4 comments

Comments

@oliTF
Copy link

oliTF commented Apr 21, 2021

System

node: 14.16.1
system: win10
electron: 12.0.4
node-gdal: 0.10.1

Problem

After installing and requiring with var gdal = require("gdal");, a cannot find module error appears:

Uncaught Error: Cannot find module '...\electron-quick-start\node_modules\gdal\lib\binding\electron-v12.0-win32-x64\gdal.node'
Require stack:
- ...\electron-quick-start\node_modules\gdal\lib\gdal.js
- ...\electron-quick-start\index.html
    at Module._resolveFilename (internal/modules/cjs/loader.js:887)
    at Function.o._resolveFilename (electron/js2c/renderer_init.js:33)
    at Module._load (internal/modules/cjs/loader.js:732)
    at Function.f._load (electron/js2c/asar_bundle.js:5)
    at Function.o._load (electron/js2c/renderer_init.js:33)
    at Module.require (internal/modules/cjs/loader.js:959)
    at require (internal/modules/cjs/helpers.js:88)
    at Object.<anonymous> (...\electron-quick-start\node_modules\gdal\lib\gdal.js:12)
    at Object.<anonymous> (....\electron-quick-start\node_modules\gdal\lib\gdal.js:701)
    at Module._compile (internal/modules/cjs/loader.js:1078)

After installation, the gdal.node is found in followin path ...\electron-quick-start\node_modules\gdal\lib\binding\node-v83-win32-x64.

I followed this issue #219 with using node-gdal 0.10.1, but I could not resolve the issue. Does it have to do something with https://github.com/mapbox/node-pre-gyp? When installing, the following warning appears:

node_gdal_install_electron

How can this problem be resolved?

@hail-kang
Copy link

gdal is a native module. See the link below.
https://www.electronjs.org/docs/tutorial/using-native-node-modules

However, even if you proceed as described in the link, problems arise.
electron/rebuild#734

@VadimCiv
Copy link

VadimCiv commented Nov 9, 2021

Can't compile !!!
I can't compiling goal-node in my electron 11 app when I use rpm install
rebuilding native dependencies [email protected] platform=win32 arch=x64
windows 10
nodes 16
electron 11
electron-builder 22

Please Help!

-napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v11.5' (1)
    npm ERR! node-pre-gyp info it worked if it ends with ok
    npm ERR! node-pre-gyp info using [email protected]
    npm ERR! node-pre-gyp info using [email protected] | win32 | x64
    npm ERR! node-pre-gyp http GET https://github.com/naturalatlas/node-gdal/releases/download/0.11.0/electron-v11.5-win32-x64-unknown.tar.gz
    npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/naturalatlas/node-gdal/releases/download/0.11.0/electron-v11.5-win32-x64-unknown.tar.gz
    npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (electron-v11.5 ABI, unknown) (falling back to source compile with node-gyp)
    npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/naturalatlas/node-gdal/releases/download/0.11.0/electron-v11.5-win32-x64-unknown.tar.gz
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using [email protected]
    npm ERR! gyp info using [email protected] | win32 | x64
    npm ERR! gyp info ok
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using [email protected]
    npm ERR! gyp info using [email protected] | win32 | x64
    npm ERR! gyp info find Python using Python version 3.9.8 found at "C:\Users\user\AppData\Local\Programs\Python\Python39\python.exe"
    npm ERR! gyp info find VS using VS2017 (15.9.28307.1745) found at:
    npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
    npm ERR! gyp info find VS run with --verbose for detailed information
    npm ERR! gyp info spawn C:\Users\user\AppData\Local\Programs\Python\Python39\python.exe
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
    npm ERR! gyp info spawn args   'binding.gyp',
    npm ERR! gyp info spawn args   '-f',
    npm ERR! gyp info spawn args   'msvs',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   'C:\\Users\\user\\git\\planner\\node_modules\\gdal\\build\\config.gypi', 
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   'C:\\Users\\user\\git\\planner\\node_modules\\gdal\\common.gypi',        
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi', 
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   'C:\\Users\\user\\.electron-gyp\\11.5.0\\include\\node\\common.gypi',
    npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
    npm ERR! gyp info spawn args   '-Dvisibility=default',
    npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\user\\.electron-gyp\\11.5.0',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\user\\\\.electron-gyp\\\\11.5.0\\\\<(target_arch)\\\\node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\user\\git\\planner\\node_modules\\gdal',   
    npm ERR! gyp info spawn args   '-Dnode_engine=v8',
    npm ERR! gyp info spawn args   '--depth=.',
    npm ERR! gyp info spawn args   '--no-parallel',
    npm ERR! gyp info spawn args   '--generator-output',
    npm ERR! gyp info spawn args   'C:\\Users\\user\\git\\planner\\node_modules\\gdal\\build',
    npm ERR! gyp info spawn args   '-Goutput_dir=.'
    npm ERR! gyp info spawn args ]
    npm ERR! gyp info ok
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using [email protected]
    npm ERR! gyp info using [email protected] | win32 | x64
    npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe 
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   'build/binding.sln',
    npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
    npm ERR! gyp info spawn args   '/nologo',
    npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64'
    npm ERR! gyp info spawn args ]
    npm ERR! gyp ERR! build error
    npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
    npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
    npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
    npm ERR! gyp ERR! System Windows_NT 10.0.19042
    npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\user\\git\\planner\\node_modules\\gdal\\lib\\binding\\gdal.node" "--module_name=gdal" "--module_path=C:\\Users\\user\\git\\planner\\node_modules\\gdal\\lib\\binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=electron-v11.5"
    npm ERR! gyp ERR! cwd C:\Users\user\git\planner\node_modules\gdal
    npm ERR! gyp ERR! node -v v16.12.0
    npm ERR! gyp ERR! node-gyp -v v8.2.0
    npm ERR! gyp ERR! not ok
    npm ERR! node-pre-gyp ERR! build error
    npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\user\git\planner\node_modules\gdal\lib\binding\gdal.node --module_name=gdal --module_path=C:\Users\user\git\planner\node_modules\gdal\lib\binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v11.5' (1)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\user\git\planner\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
    npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
    npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)    
    npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19042
    npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\git\\planner\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
    npm ERR! node-pre-gyp ERR! cwd C:\Users\user\git\planner\node_modules\gdal
    npm ERR! node-pre-gyp ERR! node -v v16.12.0
    npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.6
    npm ERR! node-pre-gyp ERR! not ok

@acesgrandpa
Copy link

Maybe you can try gdal3. js. I haven't thoroughly tested its functionality yet, but at least it can be installed。

@acesgrandpa
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants