node-sqlserver-v8 icon indicating copy to clipboard operation
node-sqlserver-v8 copied to clipboard

Failing to install using command "npm install msnodesqlv8"

Open TyCmd opened this issue 4 years ago • 40 comments

I am trying to install msnodesqlv8 with a new project but it fails to install. I tried on both Windows and Mac machines and get the same error message. Below is the output I get

npm ERR! code 1 npm ERR! path /Users/username/Developer/project/node_modules/msnodesqlv8 npm ERR! command failed npm ERR! command sh -c prebuild-install || node-gyp rebuild npm ERR! CXX(target) Release/obj.target/sqlserverv8/src/ConnectionHandles.o npm ERR! prebuild-install WARN install dlopen(/Users/username/Developer/project/node_modules/msnodesqlv8/build/Release/sqlserverv8.node, 1): Library not loaded: /usr/local/opt/unixodbc/lib/libodbc.2.dylib npm ERR! prebuild-install WARN install Referenced from: /Users/username/Developer/project/node_modules/msnodesqlv8/build/Release/sqlserverv8.node npm ERR! prebuild-install WARN install Reason: image not found 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] | darwin | x64 npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/local/opt/[email protected]/bin/python3.9" npm ERR! gyp info spawn /usr/local/opt/[email protected]/bin/python3.9 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/usr/local/lib/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 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/username/Developer/project/node_modules/msnodesqlv8/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/username/Library/Caches/node-gyp/15.11.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=/Users/username/Library/Caches/node-gyp/15.11.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/username/Library/Caches/node-gyp/15.11.0/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/username/Developer/project/node_modules/msnodesqlv8', 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 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp info spawn make npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] npm ERR! In file included from ../src/ConnectionHandles.cpp:1: npm ERR! In file included from ../src/ConnectionHandles.h:22: npm ERR! ../src/stdafx.h:37:14: fatal error: 'sqltypes.h' file not found npm ERR! #include <sqltypes.h> npm ERR! ^~~~~~~~~~~~ npm ERR! 1 error generated. npm ERR! make: *** [Release/obj.target/sqlserverv8/src/ConnectionHandles.o] Error 1 npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error: make failed with exit code: 2 npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:378:20) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) npm ERR! gyp ERR! System Darwin 20.5.0 npm ERR! gyp ERR! command "/usr/local/Cellar/node/15.11.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /Users/username/Developer/project/node_modules/msnodesqlv8 npm ERR! gyp ERR! node -v v15.11.0 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:

Here is my node and npm version: node -v v15.11.0

npm -v 7.20.1

TyCmd avatar Jul 23 '21 16:07 TyCmd

I resolved this by manually adding "msnodesqlv8": "^2.2.0" in my package.json file and doing npm install.

TyCmd avatar Jul 23 '21 16:07 TyCmd

I am having the same issue even with manually adding "msnodesqlv8": "^2.2.0" in my package.json file

marco-staizen avatar Jul 26 '21 02:07 marco-staizen

It looks like there isn't a pre-built binary for your version of Node. Since that means your system needs to build the driver from source, make sure you have installed all the prerequisites. Here are the instructions for macOS.

mtriff avatar Jul 26 '21 03:07 mtriff

can you check you have /usr/local/opt/unixodbc/lib/libodbc.2.dylib installed - this is a requirement as well as the MS driver as this library communicates to the MS driver via odbc - i.e. similar to

https://stackoverflow.com/questions/54302793/dyld-library-not-loaded-usr-local-opt-unixodbc-lib-libodbc-2-dylib

TimelordUK avatar Jul 26 '21 08:07 TimelordUK

I have been trying to get this working on Apple silicon and I can't seem to find a way. I tried the suggested fix here. I don't have the unixodbc installed under /usr/local/opt because Homebrew on Apple's ARM platform installs to /opt/homebrew. Any suggestions would be great. I'm getting the same 'sqltypes.h' file not found error.

TonyLomartire avatar Aug 15 '21 23:08 TonyLomartire

Of course I figure it out right after I comment. I'm kind of new to macOS, but I checked the Homebrew docs and it didn't say anything about setting any library paths that I saw at least. What I was able to do was replace -lodbc from the libraries section in the OS=="mac" block with /opt/homebrew/lib/libodbc.a and then add /opt/homebrew/include and /opt/homebrew/include/msodbcsql17 to the include_dirs. Then, in my project I was originally trying to build, I updated my package.json to point to this local compiled version of msnodesqlv8.

If there is some environment variable on macOS I can set to get node-gyp to find these libraries without updating the binding.gyp file I'd love to know.

TonyLomartire avatar Aug 15 '21 23:08 TonyLomartire

Thanks for looking into a solution. We will need a conditional block based on architecture. what is easiest way of seeing if we are running Apple silicon do you know. We can add a conditional variable based in this and link a different library

TimelordUK avatar Aug 16 '21 12:08 TimelordUK

Not sure if there is a more idiomatic way but I did find this: https://cutecoder.org/software/detecting-apple-silicon-shell-script/

EDIT: also https://stackoverflow.com/questions/65259300/detect-apple-silicon-from-command-line

TonyLomartire avatar Aug 16 '21 19:08 TonyLomartire

thanks - i do not have apple silicon but if you look at apple silicon branch only difference is my attempt at binding.gyp based on what you have said

note the following section you may need to change this - the value of arch variable is printed in early stages of build it should be defauled to "na" but overriden for macos .... this does build on my standard mac.

['OS=="mac"', { 'conditions': [ ['arch == "arm64"',{ 'variables': { 'link_lib%': '/opt/homebrew/lib/libodbc.a' } }], ['arch == "x86_64"',{ 'variables': { 'link_lib%': '-lodbc' } }] ],

TimelordUK avatar Aug 18 '21 12:08 TimelordUK

So I tried that branch and I'm still getting an error:

In file included from ../src/OdbcConnection.h:22:
../src/stdafx.h:41:14: fatal error: 'msodbcsql.h' file not found
    #include <msodbcsql.h>
             ^~~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sqlserverv8/src/BeginTranOperation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/lib/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/opt/homebrew/Cellar/node/16.6.2/bin/node" "/opt/homebrew/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/tony/dev/msnodesql-test
gyp ERR! node -v v16.6.2
gyp ERR! node-gyp -v v8.1.0
gyp ERR! not ok

So I compared to my file and I saw yours had the homebrew dirs listed first. I moved them to the end of the list and it worked. Which is weird because to me, that suggests it's finding the file in a directory before they hit the homebrew includes. But when I removed them, leaving only the linked part, it failed.

Seems weird but moving the Homebrew includes to the end of the list let it build.

TonyLomartire avatar Aug 27 '21 17:08 TonyLomartire

thanks - I have added some changes now on master which hopefully work - this builds and runs on my linux, windows and mac but cannot test apple silicon.

TimelordUK avatar Aug 30 '21 13:08 TimelordUK

➜  msnodesqlv8 git:(master) ✗ node-gyp build
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  ACTION Regenerating Makefile
  ACTION binding_gyp_sqlserverv8_target_print_variables src/BeginTranOperation.cpp
arch: arm64 | link_path: -L/opt/homebrew/lib -L/usr/lib -L. | msodbcsql msodbcsql17 | fileset src/BeginTranOperation.cpp src/BinaryColumn.cpp src/BoundDatum.cpp src/BoundDatumSet.cpp src/CancelOperation.cpp src/CloseOperation.cpp src/CollectOperation.cpp src/Column.cpp src/Connection.cpp src/ConnectionHandles.cpp src/EndTranOperation.cpp src/FreeStatementOperation.cpp src/MutateJS.cpp src/OdbcConnection.cpp src/OdbcConnectionBridge.cpp src/OdbcError.cpp src/OdbcHandle.cpp src/OdbcOperation.cpp src/OdbcStatement.cpp src/OdbcStatementCache.cpp src/OpenOperation.cpp src/Operation.cpp src/OperationManager.cpp src/PollingModeOperation.cpp src/PrepareOperation.cpp src/ProcedureOperation.cpp src/QueryOperation.cpp src/QueryOperationParams.cpp src/QueryPreparedOperation.cpp src/ReadColumnOperation.cpp src/ReadNextResultOperation.cpp src/ResultSet.cpp src/TimestampColumn.cpp src/UnbindOperation.cpp src/Utility.cpp src/addon.cpp src/bcp.cpp src/stdafx.cpp
  CXX(target) Release/obj.target/sqlserverv8/src/BeginTranOperation.o
In file included from ../src/BeginTranOperation.cpp:1:
In file included from ../src/OdbcConnection.h:22:
../src/stdafx.h:41:14: fatal error: 'msodbcsql.h' file not found
    #include <msodbcsql.h>
             ^~~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sqlserverv8/src/BeginTranOperation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/lib/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/opt/homebrew/Cellar/node/16.6.2/bin/node" "/opt/homebrew/bin/node-gyp" "build"
gyp ERR! cwd /Users/tony/dev/msnodesqlv8
gyp ERR! node -v v16.6.2
gyp ERR! node-gyp -v v8.1.0
gyp ERR! not ok

TonyLomartire avatar Aug 31 '21 22:08 TonyLomartire

I just tried building this with the latest version after doing an npm update and I was able to successfully build!

EDIT: Actually it looks like msnodesqlv8 no longer shows up in my package-lock.json, but I still have mssql. Seems like something changed upstream? I'm not sure, but my problem is resolved as I can now use mssql on new Apple hardware

TonyLomartire avatar Oct 12 '21 18:10 TonyLomartire

I am still seeing this issue. @TonyLomartire did you do anything extra for building?

I tried to do npm update and then node-gyp build.

➜ msnodesqlv8 git:(master) ✗ node-gyp build gyp info it worked if it ends with ok gyp info using [email protected] gyp info using [email protected] | darwin | arm64 gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] ACTION Regenerating Makefile ACTION binding_gyp_sqlserverv8_target_print_variables src/BeginTranOperation.cpp arch: arm64 | link_path: -L/opt/homebrew/lib -L/usr/lib -L. | msodbcsql msodbcsql17 | fileset src/BeginTranOperation.cpp src/BinaryColumn.cpp src/BoundDatum.cpp src/BoundDatumSet.cpp src/CancelOperation.cpp src/CloseOperation.cpp src/CollectOperation.cpp src/Column.cpp src/Connection.cpp src/ConnectionHandles.cpp src/EndTranOperation.cpp src/FreeStatementOperation.cpp src/MutateJS.cpp src/OdbcConnection.cpp src/OdbcConnectionBridge.cpp src/OdbcError.cpp src/OdbcHandle.cpp src/OdbcOperation.cpp src/OdbcStatement.cpp src/OdbcStatementCache.cpp src/OpenOperation.cpp src/Operation.cpp src/OperationManager.cpp src/PollingModeOperation.cpp src/PrepareOperation.cpp src/ProcedureOperation.cpp src/QueryOperation.cpp src/QueryOperationParams.cpp src/QueryPreparedOperation.cpp src/ReadColumnOperation.cpp src/ReadNextResultOperation.cpp src/ResultSet.cpp src/TimestampColumn.cpp src/UnbindOperation.cpp src/Utility.cpp src/addon.cpp src/bcp.cpp src/stdafx.cpp CXX(target) Release/obj.target/sqlserverv8/src/BeginTranOperation.o In file included from ../src/BeginTranOperation.cpp:1: In file included from ../src/OdbcConnection.h:22: ../src/stdafx.h:41:14: fatal error: 'msodbcsql.h' file not found #include <msodbcsql.h> ^~~~~~~~~~~~~ 1 error generated. make: *** [Release/obj.target/sqlserverv8/src/BeginTranOperation.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/lib/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:394:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Darwin 20.6.0 gyp ERR! command "/opt/homebrew/Cellar/node/16.6.2/bin/node" "/opt/homebrew/bin/node-gyp" "build" gyp ERR! cwd /Users/tony/dev/msnodesqlv8 gyp ERR! node -v v16.6.2 gyp ERR! node-gyp -v v8.1.0 gyp ERR! not ok

pateljay43 avatar Nov 01 '21 23:11 pateljay43

Have you installed the ms odbc driver for SQL server it will probably be in /opt/microsoft. This error is saying it cannot find the include file. Look in binding.gyp and see if you have the include folder on your machine. This will not compile without the ms odbc driver properly installed.

Sent from my iPhone

On 1 Nov 2021, at 23:25, Jay Patel @.***> wrote:

 I am still seeing this issue. @TonyLomartire did you do anything extra for building?

I tried to do npm update and then node-gyp build.

➜ msnodesqlv8 git:(master) ✗ node-gyp build gyp info it worked if it ends with ok gyp info using @.*** gyp info using @.*** | darwin | arm64 gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] ACTION Regenerating Makefile ACTION binding_gyp_sqlserverv8_target_print_variables src/BeginTranOperation.cpp arch: arm64 | link_path: -L/opt/homebrew/lib -L/usr/lib -L. | msodbcsql msodbcsql17 | fileset src/BeginTranOperation.cpp src/BinaryColumn.cpp src/BoundDatum.cpp src/BoundDatumSet.cpp src/CancelOperation.cpp src/CloseOperation.cpp src/CollectOperation.cpp src/Column.cpp src/Connection.cpp src/ConnectionHandles.cpp src/EndTranOperation.cpp src/FreeStatementOperation.cpp src/MutateJS.cpp src/OdbcConnection.cpp src/OdbcConnectionBridge.cpp src/OdbcError.cpp src/OdbcHandle.cpp src/OdbcOperation.cpp src/OdbcStatement.cpp src/OdbcStatementCache.cpp src/OpenOperation.cpp src/Operation.cpp src/OperationManager.cpp src/PollingModeOperation.cpp src/PrepareOperation.cpp src/ProcedureOperation.cpp src/QueryOperation.cpp src/QueryOperationParams.cpp src/QueryPreparedOperation.cpp src/ReadColumnOperation.cpp src/ReadNextResultOperation.cpp src/ResultSet.cpp src/TimestampColumn.cpp src/UnbindOperation.cpp src/Utility.cpp src/addon.cpp src/bcp.cpp src/stdafx.cpp CXX(target) Release/obj.target/sqlserverv8/src/BeginTranOperation.o In file included from ../src/BeginTranOperation.cpp:1: In file included from ../src/OdbcConnection.h:22: ../src/stdafx.h:41:14: fatal error: 'msodbcsql.h' file not found #include <msodbcsql.h> ^~~~~~~~~~~~~ 1 error generated. make: *** [Release/obj.target/sqlserverv8/src/BeginTranOperation.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/lib/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:394:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Darwin 20.6.0 gyp ERR! command "/opt/homebrew/Cellar/node/16.6.2/bin/node" "/opt/homebrew/bin/node-gyp" "build" gyp ERR! cwd /Users/tony/dev/msnodesqlv8 gyp ERR! node -v v16.6.2 gyp ERR! node-gyp -v v8.1.0 gyp ERR! not ok

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

TimelordUK avatar Nov 02 '21 08:11 TimelordUK

I was able to get this building by changing the order of the library folders as they were listed. Which doesn't make a lot of sense to me because I never installed the Rosetta version of Homebrew so there shouldn't have been another version of the driver to find, so it doesn't really make sense to me. However, on my system, that's what worked.

On Tue, Nov 2, 2021 at 4:05 AM TimelordUK @.***> wrote:

Have you installed the ms odbc driver for SQL server it will probably be in /opt/microsoft. This error is saying it cannot find the include file. Look in binding.gyp and see if you have the include folder on your machine. This will not compile without the ms odbc driver properly installed.

Sent from my iPhone

On 1 Nov 2021, at 23:25, Jay Patel @.***> wrote:

 I am still seeing this issue. @TonyLomartire did you do anything extra for building?

I tried to do npm update and then node-gyp build.

➜ msnodesqlv8 git:(master) ✗ node-gyp build gyp info it worked if it ends with ok gyp info using @.*** gyp info using @.*** | darwin | arm64 gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] ACTION Regenerating Makefile ACTION binding_gyp_sqlserverv8_target_print_variables src/BeginTranOperation.cpp arch: arm64 | link_path: -L/opt/homebrew/lib -L/usr/lib -L. | msodbcsql msodbcsql17 | fileset src/BeginTranOperation.cpp src/BinaryColumn.cpp src/BoundDatum.cpp src/BoundDatumSet.cpp src/CancelOperation.cpp src/CloseOperation.cpp src/CollectOperation.cpp src/Column.cpp src/Connection.cpp src/ConnectionHandles.cpp src/EndTranOperation.cpp src/FreeStatementOperation.cpp src/MutateJS.cpp src/OdbcConnection.cpp src/OdbcConnectionBridge.cpp src/OdbcError.cpp src/OdbcHandle.cpp src/OdbcOperation.cpp src/OdbcStatement.cpp src/OdbcStatementCache.cpp src/OpenOperation.cpp src/Operation.cpp src/OperationManager.cpp src/PollingModeOperation.cpp src/PrepareOperation.cpp src/ProcedureOperation.cpp src/QueryOperation.cpp src/QueryOperationParams.cpp src/QueryPreparedOperation.cpp src/ReadColumnOperation.cpp src/ReadNextResultOperation.cpp src/ResultSet.cpp src/TimestampColumn.cpp src/UnbindOperation.cpp src/Utility.cpp src/addon.cpp src/bcp.cpp src/stdafx.cpp CXX(target) Release/obj.target/sqlserverv8/src/BeginTranOperation.o In file included from ../src/BeginTranOperation.cpp:1: In file included from ../src/OdbcConnection.h:22: ../src/stdafx.h:41:14: fatal error: 'msodbcsql.h' file not found #include <msodbcsql.h> ^~~~~~~~~~~~~ 1 error generated. make: *** [Release/obj.target/sqlserverv8/src/BeginTranOperation.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/lib/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:394:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Darwin 20.6.0 gyp ERR! command "/opt/homebrew/Cellar/node/16.6.2/bin/node" "/opt/homebrew/bin/node-gyp" "build" gyp ERR! cwd /Users/tony/dev/msnodesqlv8 gyp ERR! node -v v16.6.2 gyp ERR! node-gyp -v v8.1.0 gyp ERR! not ok

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TimelordUK/node-sqlserver-v8/issues/214#issuecomment-957183802, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUQLGNFUC3QC2EEWEZNTRLDUJ6LTPANCNFSM5A4J577Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

TonyLomartire avatar Nov 02 '21 13:11 TonyLomartire

@TimelordUK I apologize for previous error logs as they were just a quote from few comments above mine.

This is the error log for my computer and I think I have installed ms odbc driver for SQL. With brew list I can see that I have msodbcsql17 and mssql-tools installed.

@TonyLomartire Do you mean changing the order of library folders listed in your project or this msnodesqlv8 project?

npm ERR! code 1
npm ERR! path /Users/username/Desktop/projectname/subfolder/node_modules/msnodesqlv8
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! ACTION binding_gyp_sqlserverv8_target_print_variables src/BeginTranOperation.cpp
npm ERR! arch: arm64 | link_path: -L/usr/local/lib -L/opt/homebrew/lib -L/usr/lib -L. | msodbcsql msodbcsql17 | fileset src/BeginTranOperation.cpp src/BinaryColumn.cpp src/BoundDatum.cpp src/BoundDatumSet.cpp src/CancelOperation.cpp src/CloseOperation.cpp src/CollectOperation.cpp src/Column.cpp src/Connection.cpp src/ConnectionHandles.cpp src/EndTranOperation.cpp src/FreeStatementOperation.cpp src/MutateJS.cpp src/OdbcConnection.cpp src/OdbcConnectionBridge.cpp src/OdbcError.cpp src/OdbcHandle.cpp src/OdbcOperation.cpp src/OdbcStatement.cpp src/OdbcStatementCache.cpp src/OpenOperation.cpp src/Operation.cpp src/OperationManager.cpp src/PollingModeOperation.cpp src/PrepareOperation.cpp src/ProcedureOperation.cpp src/QueryOperation.cpp src/QueryOperationParams.cpp src/QueryPreparedOperation.cpp src/ReadColumnOperation.cpp src/ReadNextResultOperation.cpp src/ResultSet.cpp src/TimestampColumn.cpp src/UnbindOperation.cpp src/Utility.cpp src/addon.cpp src/bcp.cpp src/stdafx.cpp
npm ERR!   CXX(target) Release/obj.target/sqlserverv8/src/BeginTranOperation.o
npm ERR! prebuild-install WARN install No prebuilt binaries found (target=14.18.1 runtime=node arch=arm64 libc= platform=darwin)
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] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.7 found at "/opt/homebrew/opt/[email protected]/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/username/.nvm/versions/node/v14.18.1/lib/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   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/username/Desktop/projectname/subfolder/node_modules/msnodesqlv8/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/username/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/username/Library/Caches/node-gyp/14.18.1/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=/Users/username/Library/Caches/node-gyp/14.18.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/username/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/username/Library/Caches/node-gyp/14.18.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/username/Desktop/projectname/subfolder/node_modules/msnodesqlv8',
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   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/BeginTranOperation.cpp:1:
npm ERR! In file included from ../src/OdbcConnection.h:22:
npm ERR! ../src/stdafx.h:41:14: fatal error: 'msodbcsql.h' file not found
npm ERR!     #include <msodbcsql.h>
npm ERR!              ^~~~~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/sqlserverv8/src/BeginTranOperation.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/username/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
npm ERR! gyp ERR! System Darwin 21.1.0
npm ERR! gyp ERR! command "/Users/username/.nvm/versions/node/v14.18.1/bin/node" "/Users/username/.nvm/versions/node/v14.18.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/username/Desktop/projectname/subfolder/node_modules/msnodesqlv8
npm ERR! gyp ERR! node -v v14.18.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

pateljay43 avatar Nov 02 '21 13:11 pateljay43

The order of the folders listed in the binding.gyp file of this project, specifically under the section named 'include_dirs' which itself is within a clause 'OS=="mac"'. See my older posts for details.

TonyLomartire avatar Nov 02 '21 13:11 TonyLomartire

It looks like @TimelordUK already applied your changes on master branch so basically this should work for me without changing anything. But it is not. This is the commit that has the changes as described by you https://github.com/TimelordUK/node-sqlserver-v8/commit/f450df1c912cc54ca68fc0fdcddb80b560eba14a.

There has to be something missing from the install steps because my friend is also facing same issue on Apple silicon.

pateljay43 avatar Nov 02 '21 13:11 pateljay43

where exactly is the file msodbcsql.h in your setup - there is a way to get node-gyp to show more build info somethinglike node_modules/.bin/node-gyp rebuild --verbose

it seems to be compiler cannot locate this include file from provided inputs

TimelordUK avatar Nov 03 '21 07:11 TimelordUK

Thank you. I think I found the bug and it is a missing comma in bindings.gyp file https://github.com/TimelordUK/node-sqlserver-v8/blob/master/binding.gyp#L142

pateljay43 avatar Nov 03 '21 13:11 pateljay43

@TimelordUK are you planning on adding this fix soon or would you like me to make a PR for you?

pateljay43 avatar Nov 03 '21 13:11 pateljay43

Thanks for finding it. I’ll check in to master very shortly today.

it will probably be a few days before it’s released to npm.

Sent from my iPad

On 3 Nov 2021, at 13:15, Jay Patel @.***> wrote:

 @TimelordUK are you planning on adding this fix soon or would you like me to make a PR for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

TimelordUK avatar Nov 03 '21 15:11 TimelordUK

I could also use this fix

surfjedi avatar Nov 04 '21 16:11 surfjedi

this is now released to npm

TimelordUK avatar Nov 07 '21 16:11 TimelordUK

Well I just tried to install this again and still the same error as before? C:\projects\gy3-nodejs\node_modules\msnodesqlv8>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: connect ETIMEDOUT 104.20.23.46:443 gyp ERR! stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) gyp ERR! System Windows_NT 10.0.17763 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\projects\gy3-nodejs\node_modules\msnodesqlv8 gyp ERR! node -v v14.17.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: prebuild-install || node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\g8ulpb\AppData\Roaming\npm-cache_logs\2021-11-08T18_10_59_727Z-debug.log

surfjedi avatar Nov 08 '21 18:11 surfjedi

This looks on first look to be different ie timeout could it be case you are behind firewall And node gyp cannot access the web.

Sent from my iPhone

On 8 Nov 2021, at 18:13, Lee Blazek @.***> wrote:

 Well I just tried to install this again and still the same error as before? C:\projects\gy3-nodejs\node_modules\msnodesqlv8>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: connect ETIMEDOUT 104.20.23.46:443 gyp ERR! stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) gyp ERR! System Windows_NT 10.0.17763 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\projects\gy3-nodejs\node_modules\msnodesqlv8 gyp ERR! node -v v14.17.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @.*** install: prebuild-install || node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @.*** install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\g8ulpb\AppData\Roaming\npm-cache_logs\2021-11-08T18_10_59_727Z-debug.log

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

TimelordUK avatar Nov 08 '21 18:11 TimelordUK

I have tried this on 2 different computers on two different networks and made sure that the firewall is off. And on a work PC and personal mac mini.

The same error is still occurring - has any one else gotten this to install? Has the same "...sqltypes.h" error.

see belowL Screen Shot 2021-11-09 at 5 48 19 PM

surfjedi avatar Nov 10 '21 00:11 surfjedi

The error below does not look the same. This include file where is it on your system sqltypes.h. Have you got ODBC sub system installed. The JavaScript driver talks to ODBC. ODBC then loads the ms driver. So we need ms driver and ODBC installed on target machine for this to work.

Sent from my iPad

On 10 Nov 2021, at 00:49, Lee Blazek @.***> wrote:

 I have tried this on 2 different computers on two different networks and made sure that the firewall is off. And on a work PC and personal mac mini.

The same error is still occurring - has any one else gotten this to install? Has the same "...sqltypes.h" error.

see belowL

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

TimelordUK avatar Nov 10 '21 09:11 TimelordUK

on my mac install for example

I have used openbrew to install unixodbc

and it is in location below - this is needed to build driver

[email protected]:~/dev/js/sql/node_modules/msnodesqlv8$ ls /usr/local/Cellar/unixodbc/2.3.9_1/include/sqlext.h
/usr/local/Cellar/unixodbc/2.3.9_1/include/sqlext.h
[email protected]:~/dev/js/sql/node_modules/msnodesqlv8$ odbcinst -j
unixODBC 2.3.9
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /Users/meme/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
[email protected]:~/dev/js/sql/node_modules/msnodesqlv8$ which odbcinst
/usr/local/bin/odbcinst
[email protected]:~/dev/js/sql/node_modules/msnodesqlv8$ brew list unixodbc
/usr/local/Cellar/unixodbc/2.3.9_1/.bottle/etc/ (2 files)
/usr/local/Cellar/unixodbc/2.3.9_1/bin/dltest
/usr/local/Cellar/unixodbc/2.3.9_1/bin/isql
/usr/local/Cellar/unixodbc/2.3.9_1/bin/iusql
/usr/local/Cellar/unixodbc/2.3.9_1/bin/odbc_config
/usr/local/Cellar/unixodbc/2.3.9_1/bin/odbcinst
/usr/local/Cellar/unixodbc/2.3.9_1/bin/slencheck
/usr/local/Cellar/unixodbc/2.3.9_1/include/ (11 files)
/usr/local/Cellar/unixodbc/2.3.9_1/lib/libodbc.2.dylib
/usr/local/Cellar/unixodbc/2.3.9_1/lib/libodbccr.2.dylib
/usr/local/Cellar/unixodbc/2.3.9_1/lib/libodbcinst.2.dylib
/usr/local/Cellar/unixodbc/2.3.9_1/lib/pkgconfig/ (3 files)
/usr/local/Cellar/unixodbc/2.3.9_1/lib/ (6 other files)
/usr/local/Cellar/unixodbc/2.3.9_1/share/man/ (8 files)
[email protected]:~/dev/js/sql/node_modules/msnodesqlv8$ 

TimelordUK avatar Nov 10 '21 20:11 TimelordUK