WiseLibs / better-sqlite3

The fastest and simplest library for SQLite3 in Node.js.
MIT License
5.22k stars 390 forks source link

Error installing in an Azure Function #935

Closed GP4cK closed 1 year ago

GP4cK commented 1 year ago

Sorry if this is too specific. I'm trying to use better-sqlite3 in a Windows Azure Function (node 16). While deploying, this is the error I get:

npm notice New major version of npm available! 8.11.0 -> 9.2.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
npm notice Run `npm install -g npm@9.2.0` to update!
npm notice 
npm ERR! code 1
npm ERR! path C:\home\site\wwwroot\node_modules\better-sqlite3
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild --release
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR!   copy_builtin_sqlite3
npm ERR! cl : Command line warning D9002: ignoring unknown option '/Zc:__cplusplus' [C:\home\site\wwwroot\node_modules\better-sqlite3\build\deps\sqlite3.vcxproj]
npm ERR!   sqlite3.c
npm ERR! cl : Command line warning D9002: ignoring unknown option '/Zc:__cplusplus' [C:\home\site\wwwroot\node_modules\better-sqlite3\build\deps\sqlite3.vcxproj]
npm ERR!   win_delay_load_hook.cc
npm ERR!   sqlite3.vcxproj -> C:\home\site\wwwroot\node_modules\better-sqlite3\build\Release\\sqlite3.lib
npm ERR! cl : Command line warning D9002: ignoring unknown option '/Zc:__cplusplus' [C:\home\site\wwwroot\node_modules\better-sqlite3\build\better_sqlite3.vcxproj]
npm ERR! cl : Command line warning D9002: ignoring unknown option '/std:c++17' [C:\home\site\wwwroot\node_modules\better-sqlite3\build\better_sqlite3.vcxproj]
npm ERR!   better_sqlite3.cpp
npm ERR! ./src/better_sqlite3.lzz(8): fatal error C1083: Cannot open include file: 'unordered_map': No such file or directory [C:\home\site\wwwroot\node_modules\better-sqlite3\build\better_sqlite3.vcxproj]
npm ERR! cl : Command line warning D9002: ignoring unknown option '/Zc:__cplusplus' [C:\home\site\wwwroot\node_modules\better-sqlite3\build\test_extension.vcxproj]
npm ERR!   test_extension.c
npm ERR! cl : Command line warning D9002: ignoring unknown option '/Zc:__cplusplus' [C:\home\site\wwwroot\node_modules\better-sqlite3\build\test_extension.vcxproj]
npm ERR!   win_delay_load_hook.cc
npm ERR!      Creating library C:\home\site\wwwroot\node_modules\better-sqlite3\build\Release\test_extension.lib and object C:\home\site\wwwroot\node_modules\better-sqlite3\build\Release\test_extension.exp
An error has occurred during web site deployment.
npm ERR!   Generating code
npm ERR!   All 3 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
npm ERR!   Finished generating code
npm ERR!   test_extension.vcxproj -> C:\home\site\wwwroot\node_modules\better-sqlite3\build\Release\\test_extension.node
npm ERR!   test_extension.vcxproj -> C:\home\site\wwwroot\node_modules\better-sqlite3\build\Release\test_extension.pdb (Full PDB)
npm ERR! prebuild-install warn install No prebuilt binaries found (target=16.16.0 runtime=node arch=ia32 libc= platform=win32)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | win32 | ia32
npm ERR! gyp info find Python using Python version 3.6.6 found at "C:\Python34\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v16.16.0/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.16.0/win-x64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.16.0/win-arm64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.16.0/win-x64/node.lib
npm ERR! gyp http 404 https://nodejs.org/download/release/v16.16.0/win-arm64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.16.0/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
npm ERR! gyp info find VS using VS2015 (14.0) found at:
npm ERR! gyp info find VS "D:\Program Files (x86)\Microsoft Visual Studio 14.0"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python34\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Program Files (x86)\\npm\\8.11.0\\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:\\home\\site\\wwwroot\\node_modules\\better-sqlite3\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Program Files (x86)\\npm\\8.11.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\local\\LocalAppData\\node-gyp\\Cache\\16.16.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:\\local\\LocalAppData\\node-gyp\\Cache\\16.16.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files (x86)\\npm\\8.11.0\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\local\\\\LocalAppData\\\\node-gyp\\\\Cache\\\\16.16.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\home\\site\\wwwroot\\node_modules\\better-sqlite3',
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:\\home\\site\\wwwroot\\node_modules\\better-sqlite3\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\MSBuild\14.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=Win32'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\npm\8.11.0\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.14393
npm ERR! gyp ERR! command "C:\\Program Files (x86)\\nodejs\\16.16.0\\node.exe" "C:\\Program Files (x86)\\npm\\8.11.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
npm ERR! gyp ERR! cwd C:\home\site\wwwroot\node_modules\better-sqlite3
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

Would you happen to know how to fix it?

neoxpert commented 1 year ago

IS it correct that you want / need to use Win32? If so it seems that the you might require a newer version of the Visual Studio compiler as the version 14 (VS2015) is not capable of compiling the lib due to the missing c++17 support. Unfortunately there is no prebuilt version of better-sqlite3 for a 32bit NodeJS.

GP4cK commented 1 year ago

Thanks for taking the time to answer. That Azure Function was created a long time ago. Now, I may have the option to run it on win64. I've switched back to sqlite3 in the meantime but I'll keep that in mind for the next time.