I am trying to deploy my app to Heroku but keep getting this error and i couldn't find the solution. My database is already on a server and can connect without a problem.
-----> Building on the Heroku-20 stack -----> Using buildpack: heroku/nodejs -----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error USE_YARN_CACHE=true NODE_VERBOSE=false NODE_ENV=production NODE_MODULES_CACHE=true
-----> Installing binaries engines.node (package.json): 16.1.0 engines.npm (package.json): unspecified (use default) engines.yarn (package.json): unspecified (use default)
Resolving node version 16.1.0... Downloading and installing node 16.1.0... Using default npm version: 7.11.2 Resolving yarn version 1.22.x... Downloading and installing yarn (1.22.10) Installed yarn 1.22.10
-----> Installing dependencies Installing node modules (yarn.lock) yarn install v1.22.10 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... error /tmp/build_513662c2/node_modules/msnodesqlv8: Command failed. Exit code: 1 Command: prebuild-install || node-gyp rebuild Arguments: Directory: /tmp/build_513662c2/node_modules/msnodesqlv8 Output: (node:801) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only. (Use
node --trace-deprecation ...
to show where the warning was created) make: Entering directory '/tmp/build_513662c2/node_modules/msnodesqlv8/build' CXX(target) Release/obj.target/sqlserverv8/src/ConnectionHandles.o In file included from ../src/ConnectionHandles.h:22, from ../src/ConnectionHandles.cpp:1: ../src/stdafx.h:37:14: fatal error: sqltypes.h: No such file or directory 37 | #include <sqltypes.h> | ^~~~~~~~~~~~ compilation terminated. make: *** [sqlserverv8.target.mk:164: Release/obj.target/sqlserverv8/src/ConnectionHandles.o] Error 1 make: Leaving directory '/tmp/build_513662c2/node_modules/msnodesqlv8/build' gyp ERR! build error gyp ERR! stack Error:make
failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/tmp/build_513662c2/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:365:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Linux 4.4.0-1088-aws gyp ERR! command "/tmp/build_513662c2/.heroku/node/bin/node" "/tmp/build_513662c2/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /tmp/build_513662c2/node_modules/msnodesqlv8 gyp ERR! node -v v16.1.0 gyp ERR! node-gyp -v v7.1.2 gyp ERR! not ok info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. -----> Build failedWe're sorry this build is failing! You can troubleshoot common issues here: https://devcenter.heroku.com/articles/troubleshooting-node-deploys If you're stuck, please submit a ticket so we can help: https://help.heroku.com/ Love, Heroku ! Push rejected, failed to compile Node.js app. ! Push failed
I think its something about "msnodesqlv8" because when i delete it from package.json everything seems to be working fine and app can be deployed. Any help would be appreciated.
Linux requires installing Microsoft drivers for SQL Server.
See the instructions here: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15