gpt4 book ai didi

使用 sequelize 连接 Postgresql 数据库

转载 作者:行者123 更新时间:2023-12-03 22:24:45 42 4
gpt4 key购买 nike

我使用 psql 而不是 pgadmin 与 sequelize 交互,因此在运行 sequelize db:migrate 时错误显示 ERROR: Error reading "config/database.js". Error: TypeError: Cannot read property 'USER' of undefined
我认为我的配置文件有问题,因为我刚刚开始,下面是我的配置文件:-

APP_KEY=
APP_URL=http://localhost:3001/
APP_PORT=3001


DB_HOST=localhost
DB_USER=postgres
DB_PASSWORD=hidden
DB_DATABASE=chat_app

最佳答案

我找到了解决方案,它在 config/database.js 中 DB_HOST 没有正确定义。另外,记得在执行 db:migrate 时检查表。

关于使用 sequelize 连接 Postgresql 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65821897/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com