TimelordUK / node-sqlserver-v8

branched from node-sqlserver, SQL server driver compatible with all versions of Node
Other
135 stars 43 forks source link

Keep saying Module not found of sqlserverv8 #294

Open carltin0315 opened 1 year ago

carltin0315 commented 1 year ago

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. msnodesqlv8

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 }; `

DaveMcNamara commented 1 year ago

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.

carltin0315 commented 1 year ago

by going into /lib/util.js and changing the require path for cppDriver to inc

Not work for me. It gives me same error of Module not found: Can't resolve '../build/Release/sqlserverv8'

henriquedpn commented 1 year ago

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?

muhaimincs commented 1 year ago

what is the right approach after successfully npm install? I think docs are too much information and misleading too

TimelordUK commented 8 months ago

looks similar to this issue which can be fixed as described

TimelordUK commented 8 months ago

https://github.com/TimelordUK/node-sqlserver-v8/releases

look at release notes this should now sort out NextJS based problems