MongoError:无法在本地运行项目

时间:2018-02-23 09:15:18

标签: mongodb reactjs frontend

我试图在本地运行该项目的前端,但它给出了这个错误:

  

服务器侦听端口8080连接错误:{MongoError:failed   在第一次连接时连接到服务器[aman:27017] [MongoError:   getaddrinfo ENOTFOUND aman aman:27017]

以下是/_config.js看起来

的方式
const hostname = 'localhost';
const port = '8080';

const secret = 'amangrk';
const debug = true;
const clientPort = 3000;

const mailgun_apiKey = 'amangrk';
const mailgun_domain = 'amangrk';

module.exports = {
  debug: debug,
  port: port,
  urlAndPort: 'http://' + hostname + ':' + port,
  hostName: hostname,
  clientHostName: hostname,
  clientPort: clientPort,
  clientHostNameAndPort: hostname + clientPort,
  redirectURL: 'http://' + hostname + ':' + clientPort + "/temp",
  preRender: false,
  url: 'http://' + hostname,
  secret: secret,
  filesDirectory: '/files',
  rootDirectory: __dirname,
  mailgun: {
    apiKey: mailgun_apiKey,
    domain: mailgun_domain
  }
};

1 个答案:

答案 0 :(得分:0)

尝试使用此命令 mongo --host服务器IP地址

*将服务器IP提供为localhost