Closed HaiBo-Xiao closed 1 year ago
@HaiBo-Xiao You need to use x64 version of node.js on M1 chip system. Replace your existing node.js directory with this one (https://nodejs.org/dist/v18.6.0/node-v18.6.0-darwin-x64.tar.gz) and try. It should work. Thanks.
@bimalkjha Thanks for replying. I have test in Windows 10 OS. I created a new Angular project with Angular Univarsal. Then I just install ibm_db and write some code that use ibm_db to connect DB2. then I run project and got the same issue.
Compiled successfully. C:\angular\angularDemo\dist\angularDemo\server\main.js:810 throw err; ^
Error: Could not locate the bindings file. Tried:
→ C:\angular\angularDemo\build\odbc_bindings.node
→ C:\angular\angularDemo\build\Debug\odbc_bindings.node
→ C:\angular\angularDemo\build\Release\odbc_bindings.node
→ C:\angular\angularDemo\out\Debug\odbc_bindings.node
→ C:\angular\angularDemo\Debug\odbc_bindings.node
→ C:\angular\angularDemo\out\Release\odbc_bindings.node
→ C:\angular\angularDemo\Release\odbc_bindings.node
→ C:\angular\angularDemo\build\default\odbc_bindings.node
→ C:\angular\angularDemo\compiled\16.16.0\win32\x64\odbc_bindings.node
→ C:\angular\angularDemo\addon-build\release\install-root\odbc_bindings.node
→ C:\angular\angularDemo\addon-build\debug\install-root\odbc_bindings.node
→ C:\angular\angularDemo\addon-build\default\install-root\odbc_bindings.node
→ C:\angular\angularDemo\lib\binding\node-v93-win32-x64\odbc_bindings.node
at bindings (C:\angular\angularDemo\dist\angularDemo\server\main.js:806:9)
at Object.23736 (C:\angular\angularDemo\dist\angularDemo\server\main.js:48504:54)
at __webpack_require__ (C:\angular\angularDemo\dist\angularDemo\server\main.js:200396:42)
at C:\angular\angularDemo\dist\angularDemo\server\main.js:200480:64
at C:\angular\angularDemo\dist\angularDemo\server\main.js:200564:3
at Object.
A server error has occurred. node exited with 1 code.
I also use node-gyp to compile ibm_db cpp extension..and got issue below:
C:\angular\angularDemo\dist\angularDemo\server\main.js:801 throw e; ^
Error: The specified module could not be found. \?\C:\angular\angularDemo\build\odbc_bindings.node at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at bindings (C:\angular\angularDemo\dist\angularDemo\server\main.js:792:48) at Object.23736 (C:\angular\angularDemo\dist\angularDemo\server\main.js:48504:54) at __webpack_require__ (C:\angular\angularDemo\dist\angularDemo\server\main.js:200396:42) at C:\angular\angularDemo\dist\angularDemo\server\main.js:200480:64 at C:\angular\angularDemo\dist\angularDemo\server\main.js:200564:3 { code: 'ERR_DLOPEN_FAILED' }
A server error has occurred. node exited with 1 code.
I think the issue is nothing about Apple M1..
@HaiBo-Xiao Please share the complete output of npm install ibm_db
command without leaving any text output. We need complete output.
Just after installing ibm_db and before running your project, open ibm_db\test\config.testConnectionStrings.json
file, update database connection string in this file and save. Then execute node test\test-basic-test.js
command and share the complete output.
After getting the complete output of npm install ibm_db
and node test\test-basic-test.js
commands only we'll be able to help further. We have clearly mentioned about it in the issue template as below:
For connection related issue, update database connection info in ibm_db/test/config.testConnectionStrings.json
file
and share complete output of below commands:
Thanks.
Closing the issue due to inactivity. Once you share the requested information, we can reopen the issue. Thanks.
Operating System Name:
db2level output from clidriver if in use:
Target Db2 Server Version:
node.js Version:
ibm_db version:
For non-Windows, output of below commands: uname uname -m
Value of below environment variables if set: IBM_DB_HOME: PATH: LIB/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH:
Test script to reproduce the problem.
For installation related issue, complete output of
npm install ibm_db
command.For connection related issue, update database connection info in
ibm_db/test/config.testConnectionStrings.json
file and share complete output of below commands:Steps to Reproduce: I am using MacBook Pro M1pro. Project is Angular+Angular Universal. I am trying to connect DB2 in Angular Universal. Node version: v16.14.2 ibm_db version: v2.8.2 I have changed to x86_64 by 'arch -x86_64 zsh' command
1.I install ibm_db in my project and add the code of connect db2 following examples 2.Then I got this issue:
Could not locate the bindings file. Tried: → /Users/hyper/src/demo-db2/build/odbc_bindings.node → /Users/hyper/src/demo-db2/build/Debug/odbc_bindings.node → /Users/hyper/src/demo-db2/build/Release/odbc_bindings.node → /Users/hyper/src/demo-db2/out/Debug/odbc_bindings.node → /Users/hyper/src/demo-db2/Debug/odbc_bindings.node → /Users/hyper/src/demo-db2/out/Release/odbc_bindings.node → /Users/hyper/src/demo-db2/Release/odbc_bindings.node → /Users/hyper/src/demo-db2/build/default/odbc_bindings.node → /Users/hyper/src/demo-db2/compiled/16.14.2/darwin/arm64/odbc_bindings.node → /Users/hyper/src/demo-db2/addon-build/release/install-root/odbc_bindings.node → /Users/hyper/src/demo-db2/addon-build/debug/install-root/odbc_bindings.node → /Users/hyper/src/demo-db2/addon-build/default/install-root/odbc_bindings.node → /Users/hyper/src/demo-db2/lib/binding/node-v93-darwin-arm64/odbc_bindings.node
3.I found that ibm_db has some c++ extension, so the pre_build can't compile it into main.js. I found a package node-gyp to compile ibm_db to get odbc_bindings.node.
I success compile ibm_db in using node-gyp and get odbc_bindings.node. I add it to /Users/hyper/src/demo-db2/build/odbc_bindings.node
Then I got another issue:
(node:14282) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use
node --trace-deprecation ...
to show where the warning was created) dyld[14282]: missing symbol calledit seems that ie can't work in typescript?
My question: how can I use this package in Angular Universal under typescript?