Description of the problem:
问题描述:
I'm working on a React project and when trying to run npm start
on the server folder, I get the following error:
我正在处理一个Reaction项目,当尝试在服务器文件夹上运行NPM Start时,我收到以下错误:
HostNotFoundError [SequelizeHostNotFoundError]: getaddrinfo ENOTFOUND undefined
Problem Details:
The project consists of three important files in the server folder: db.js, index.js and server.js. I think the error might be related to one of these files, but I'm not sure which one.
I leave you the link to the project's github repository:
Link to the Repository: https://github.com/Mateo-mh/PI-countries
Steps to Reproduce the Error:
1) I navigate to the server folder in my project.
2) I run the npm start command in the terminal.
Complete Error Message:
[0] HostNotFoundError [SequelizeHostNotFoundError]: getaddrinfo ENOTFOUND undefined
[0] parent: Error: getaddrinfo ENOTFOUND undefined
[0] at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
[0] errno: -3008,
[0] code: 'ENOTFOUND',
[0] syscall: 'getaddrinfo',
[0] hostname: 'undefined'
[0] },
[0] original: Error: getaddrinfo ENOTFOUND undefined
[0] at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
[0] errno: -3008,
[0] code: 'ENOTFOUND',
[0] syscall: 'getaddrinfo',
[0] hostname: 'undefined'
[0] }
[0] }
Tools and Technologies Version:
Node.js: v18.16.1
sequelize: v6.31.1
I would greatly appreciate your help in resolving this issue. Does anyone have any idea why I'm getting this error and how I can fix it?
更多回答
Can you show your sequelize code where you connect to the database?
你能在你连接到数据库的地方展示你的顺序化代码吗?
优秀答案推荐
It looks like there is issue in db.js where you had define your database cred, as according to error your database cred is wrong.
看起来在您定义数据库凭据时,在db.js中有问题,因为根据错误,您的数据库凭据是错误的。
更多回答
我是一名优秀的程序员,十分优秀!