0

I'm trying to connect a sql server with windows authentication, so I installed the mssql and msnodesqlv8 attempt to achieve it.

And I create a connection with code below:

import sql from "mssql/msnodesqlv8";

const config = {
  database: "db_name",
  server: "server_name",
  driver: "msnodesqlv8",
  options: {
    trustedConnection: true,
  },
};

const conn = new sql.ConnectionPool(config);

conn
  .connect()
  .then((res) => console.log("Connected to MSSQL database."))
  .catch((err) => {
    console.log("Error connecting to MSSQL database:", err);
  });

export default conn;

But it keep saying module not found:

enter image description here

I ensure that the sqlserverv8.node is existed inside the nodemodules folder, and I did try to delete the node_modules and reinstall all of stuffs but the result is same.

Did someone faced the same problem and solve it succuessfully?

Carl.t_
  • 37
  • 4

0 Answers0