Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep saying Module not found of sqlserverv8 #294

Open
carltin0315 opened this issue Jun 19, 2023 · 6 comments
Open

Keep saying Module not found of sqlserverv8 #294

carltin0315 opened this issue Jun 19, 2023 · 6 comments

Comments

@carltin0315
Copy link

carltin0315 commented Jun 19, 2023

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
Copy link

DaveMcNamara commented Jun 23, 2023

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
Copy link
Author

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
Copy link

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
Copy link

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

@TimelordUK
Copy link
Owner

looks similar to this issue which can be fixed as described

@TimelordUK
Copy link
Owner

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants