问题描述:
我正在开发一个 React 项目,当尝试在服务器文件夹上运行
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?
看起来您定义数据库信用的db.js中存在问题,因为根据错误,您的数据库信用是错误的。