【发布时间】:2021-06-13 16:08:29
【问题描述】:
在旧配置中,我使用 mssql 作为数据库,
ormconfig.json:
{
"type": "mssql",
"host": "localhost",
"port": "1433",
"username": "sa",
"password": "*******",
"database": "onboarding",
"synchronize": true ,
"logging": true,
"entities": ["./src/**/*.entity.ts", "./dist/**/*.entity.js"]
}
然后我将配置更改为使用 postgres
{
"type": "postgres",
"host": "localhost",
"port": "5432",
"username": "root",
"password": "*******",
"database": "onboarding",
"synchronize": true ,
"logging": true,
"entities": ["./src/**/*.entity.ts", "./dist/**/*.entity.js"]
}
然后我卸载了mssql驱动并通过npm添加了postgres驱动,重启我的程序后,TypeOrm一直在询问mssql
[Nest] 40351 - 06/13/2021, 11:01:49 PM [TypeOrmModule] Unable to connect to the database. Retrying (5)... +3005ms
DriverPackageNotInstalledError: SQL Server package has not been found installed. Try to install it: npm install mssql --save
有人知道为什么没有加载新配置吗?我试过 npm clean 缓存,删除 node_modules 和 dist 文件夹,但还是不行。
【问题讨论】:
标签: node.js nestjs typeorm node.js-typeorm