尝试为Express应用程序启动NodeJS时Openshift出错

时间:2014-07-29 06:57:40

标签: node.js express openshift

我用Expressjs和Nodejs制作了一个简单的Web应用程序(使用MEAN.js堆栈)。 我使用SSH访问将我的web应用程序从git拉到了我的Openshift服务器。

安装完所有模块后,我配置了我的MongoDB URI,然后为了启动我的服务器,我在项目服务器上执行此命令:

NODE_ENV=production npm start

我收到了这个错误:

      Fatal error: listen EACCES
      Warning:  Used --force, continuing.


      Running "nodemon:dev" (nodemon) task
  [nodemon] v1.0.20
  [nodemon] to restart at any time, enter `rs`
  [nodemon] watching: app/views/**/*.* gruntfile.js server.js config/**/*.js app/**/*.js
  [nodemon] starting `node --debug server.js`
  debugger listening on port 5858
  Failed to open socket on port 5858, waiting 1000 ms before retrying

   Application loaded using the "production" environment configuration

  js-bson: Failed to load c++ bson extension, using pure JS version
  Failed to open socket on port 5858, waiting 1000 ms before retrying
  Failed to open socket on port 5858, waiting 1000 ms before retrying
  Failed to open socket on port 5858, waiting 1000 ms before retrying
  Failed to open socket on port 5858, waiting 1000 ms before retrying
  Failed to load c++ bson extension, using pure JS version
  Failed to open socket on port 5858, waiting 1000 ms before retrying
  Failed to open socket on port 5858, waiting 1000 ms before retrying
  MEAN.JS application started on port 8081

  events.js:72
          throw er; // Unhandled 'error' event
                ^
  Error: listen EACCES
      at errnoException (net.js:901:11)
      at Server._listen2 (net.js:1020:19)
      at listen (net.js:1061:10)
      at Server.listen (net.js:1135:5)
      at Function.app.listen (/var/lib/openshift/53be9cb55004467d130002a4/app-deployments/2014-07-10_10-01-30.769/MeanApp/node_modules/express/lib/application.js:532:24)
      at Object.<anonymous> (/var/lib/openshift/53be9cb55004467d130002a4/app-deployments/2014-07-10_10-01-30.769/MeanApp/server.js:25:5)
      at Module._compile (module.js:456:26)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
  [nodemon] app crashed - waiting for file changes before starting...

为了修复它,我搜索了错误并在StackOverflow中查找了解决方案。 这似乎是一个端口问题所以我试图将端口更改为8080,8081,3000,但没有解决问题。

你有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你需要绑定到你的装备的IP地址和端口8080,你不能绑定到0.0.0.0(这是它默认尝试做的)