I tested the code on localhost, it is working so far, but when deploying on render, it has
errors. I used mssql npm package and msnodesqlv8 npm package to access the mssql database. The front-end has no issues so far, because upon commenting this particular code ‘const mysql = require(‘mssql/msnodesqlv8’);’ the deployment is working so far. I can confirm that both mssql and msnodesqlv8 package is installed in my nodes_modules folder and stated explicitly in package.json. What can do to solve this kind of error? and What are the reasons these kind of errors are occurring?
=> Downloading cache...
==> Transferred 73MB in 7s. Extraction took 2s.
==> Using Node version 20.11.1 (default)
==> Docs on specifying a Node version: https://render.com/docs/node-version
==> Running build command 'yarn'...
yarn install v1.22.22
warning package.json: No license field
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning No license field
[1/4] Resolving packages...
warning mssql-session-store > mssql > tedious > sprintf@0.1.5: The sprintf package is deprecated in favor of sprintf-js.
warning mssql-session-store > mssql > tedious > babel-runtime > core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /opt/render/project/src/node_modules/msnodesqlv8: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments:
Directory: /opt/render/project/src/node_modules/msnodesqlv8
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Output:
make: Entering directory '/opt/render/project/src/node_modules/msnodesqlv8/build'
ACTION binding_gyp_sqlserverv8_target_print_variables src/BeginTranOperation.cpp
cflags_cpp -std=c++17 | arch: x86_64 | link_path: -L/usr/local/lib -L/usr/lib -L. | msodbc_include_folders | 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/OdbcConnection.h:22,
from ../src/BeginTranOperation.cpp:1:
../src/stdafx.h:37:14: fatal error: sqltypes.h: No such file or directory
#include <sqltypes.h>
^~~~~~~~~~~~
compilation terminated.
make: *** [sqlserverv8.target.mk:174: Release/obj.target/sqlserverv8/src/BeginTranOperation.o] Error 1
make: Leaving directory '/opt/render/project/src/node_modules/msnodesqlv8/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/opt/render/project/nodes/node-20.11.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Linux 5.15.0-1055-aws
gyp ERR! command "/opt/render/project/nodes/node-20.11.1/bin/node" "/opt/render/project/nodes/node-20.11.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/render/project/src/node_modules/msnodesqlv8
gyp ERR! node -v v20.11.1
gyp ERR! node-gyp -v v10.0.1
gyp ERR! not ok
==> Build failed 😞