How to build the project ?
Closed this issue · 2 comments
My system
odbc
Package Version: 2.4.8- node@16.20.2 | linux | x64
- node-gyp@10.0.1
- Python version 3.11.2
Describe the bug
When trying to compile some changes using node-gyp rebuild
from the installed version, I get the followed error:
root@9ae51fa11c35:/home/node/app/node_modules/odbc# node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@10.0.1
gyp info using node@16.20.2 | linux | x64
gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/node/app/node_modules/odbc/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.cache/node-gyp/16.20.2/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/16.20.2',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/16.20.2/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/node/app/node_modules/odbc',
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 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp: Undefined variable module_name 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.<anonymous> (/usr/local/lib/node_modules/node-gyp/lib/configure.js:271:18)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 5.15.133.1-microsoft-standard-WSL2
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/node/app/node_modules/odbc
gyp ERR! node -v v16.20.2
gyp ERR! node-gyp -v v10.0.1
gyp ERR! not ok
After some research, through some old versions of node-odbc
, I managed to compile using:
node-gyp rebuild --module_name="odbc" --module_path="./lib/bindings/napi-v6"
But then the odbc.node
file isn't in the lib
folder as asked by the --module-path
option, so I do it by hand:
cp build/lib/bindings/napi-v6/odbc.node lib/bindings/napi-v6/odbc.node
and then I have a working build.
Expected behavior
Obviously I'm doing some kind of hack to make it work, I expect some guide somewhere to build the project correctly.
It appears that it will build during initial dependency install with npm ci
. After that there's a script in package.json aka npm run build
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.