每当我尝试在 openshift 中将 Express 更新到 4.2.0 时,都会收到 503 错误。关于如何解决这个问题有什么想法吗?我所做的就是创建一个 NodeJS 应用程序,添加 MongoDB 盒并使用 ssh,更新 package.json 以将 express 设置为 4.2.0 并运行 npm install。重新启动应用程序后,我在网页上收到 503。 openshift 支持 ExpressJS 版本 4 吗?
最佳答案
我也遇到了同样的问题。使用express 4.9.8,我可以在本地运行得很好,但是当在 OpenShift 上部署后尝试运行时,我得到以下信息:
==> app-root/logs/nodejs.log-20150224074926 <==
};
mixin(app, proto);
mixin(app, EventEmitter.prototype);
app.request = { __proto__: req, app: app };
app.response = { __proto__: res, app: app };
app.init();
return app;
} has no method 'createServer'
at self.initializeServer (/var/lib/openshift/54e8fbd85973ca16e40000d6/app-root/runtime/repo/server.js:116:28)
at self.initialize (/var/lib/openshift/54e8fbd85973ca16e40000d6/app-root/runtime/repo/server.js:134:14)
==> app-root/logs/nodejs.log-20150224095524 <==
app.handle(req, res, next);
};
mixin(app, proto);
mixin(app, EventEmitter.prototype);
app.request = { __proto__: req, app: app };
app.response = { __proto__: res, app: app };
app.init();
return app;
} has no method 'createServer'
at self.initializeServer (/var/lib/openshift/54e8fbd85973ca16e40000d6/app-root/runtime/repo/server.js:116:28)
我的印象是 OpenShift 不支持较新版本的 Express。
关于node.js - OpenShift 问题中的 ExpressJS 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24894199/