Error: Please install tedious package Manually

Asked

Viewed 58 times

-1

I am trying to do a project in Node.js / Electron and need to get information from an SQL Server database. When I run the line below, the error appears:

const db = new Sequelize('banco', 'sa', 'xxyyuuu',{dialect:"mssql", host: "servidor"});

Uncaught Exception: Error: Please install tedious package manually
    at ConnectionManager._loadDialectModule (webpack:///./node_modules/sequelize/lib/dialects/abstract/connection-manager.js?:81:15)
    at new ConnectionManager (webpack:///./node_modules/sequelize/lib/dialects/mssql/connection-manager.js?:16:21)
    at new MssqlDialect (webpack:///./node_modules/sequelize/lib/dialects/mssql/index.js?:15:30)
    at new Sequelize (webpack:///./node_modules/sequelize/lib/sequelize.js?:340:20)
    at eval (webpack:///./src/backend/db.js?:3:12)
    at Object../src/backend/db.js (C:\laragon\www\kds-vue\dist_electron\index.js:8609:1)
    at __webpack_require__ (C:\laragon\www\kds-vue\dist_electron\index.js:20:30)
    at eval (webpack:///./src/backend/index.js?:2:13)
    at Object../src/backend/index.js (C:\laragon\www\kds-vue\dist_electron\index.js:8620:1)
    at __webpack_require__ (C:\laragon\www\kds-vue\dist_electron\index.js:20:30)

I already reinstalled everything in a new directory and could not find a solution.

1 answer

0

Based on the link quoted in the comments, I did the following to resolve:

I created a file called db.js with the following code:

import * as tedious from 'tedious';

const Sequelize = require('sequelize');
const db = new Sequelize('banco', 'usuario', 'senha',{dialect:"mssql", dialectModule : tedious, host: "hostdb"});

export {
    db
}

What I did differently:

  • import * as tedious from 'tedious';
  • dialectModule : tedious
  • export { db }

That solved the problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.