Node.js MSSQL tedius ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED
The solution is to enable TCP connections which are disabled by default.
My case wasn't exactly the same as Matt's, but his screenshot was enough to remember me what was missing.
As it is said here, when you are using the SQL Server Instance Name to connect to it, you must have SQL Server Browser running.
options.instanceName
The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable.
(no default)
Mutually exclusive with options.port.
If after enabling the TCP connection and still your configuration is not working. Here's my own-configuration.
var config = {
"user": 'admin',
"password": 'password',
"server": 'ALBERT-PC',
"database": 'database_name',
"port": '61427',
"dialect": "mssql",
"dialectOptions": {
"instanceName": "SQLEXPRESS"
}
};