node-sqlserver-v8
node-sqlserver-v8 copied to clipboard
Keep saying Module not found of sqlserverv8
I installed this lib with setting NODE_TLS_REJECT_UNAUTHORIZED with 0. But when I call it, it says:
./node_modules/msnodesqlv8/lib/util.js:5:20 Module not found: Can't resolve '../build/Release/sqlserverv8'
I ensure the sqlserverv8.node exist inside the node_modules.
But it just keep saying module not found.
I'm using it in a next.js web application and here is my code:
`import sql from "mssql/msnodesqlv8";
const conn = new sql.connect(
{
database: "db_name",
server: "1.1.1.1",
driver: "msnodesqlv8",
options: {
encrypt: false,
trustedConnection: true,
},
},
(err) => {
if (err) {
console.log(Error while connecting database: ,${err});
} else {
console.log(connected to database);
}
}
);
export { conn };
`
I am also seeing this, the issue began when I upgraded Node to LTS (18.16.1).
I got it to work by going into /lib/util.js and changing the require path for cppDriver to include the file extension. So, changing '../build/Release/sqlserverv8' to '../build/Release/sqlserverv8.node'. Not a legit solution, but good enough for my current purposes and maybe good info on what's not working here.
by going into /lib/util.js and changing the require path for
cppDriverto inc
Not work for me. It gives me same error of Module not found: Can't resolve '../build/Release/sqlserverv8'
It didn't work for me either. I can even delete the util.js file, change whatever inside it, clean npm cache and it still fail to compile with same error. is there any other cache I should clean?
what is the right approach after successfully npm install? I think docs are too much information and misleading too
looks similar to this issue which can be fixed as described
https://github.com/TimelordUK/node-sqlserver-v8/releases
look at release notes this should now sort out NextJS based problems