使用nodejs的openshift不遵守package.json中我的服务器文件的路径 [英] openshift with nodejs isn't respecting the path to my server file in package.json

查看:90
本文介绍了使用nodejs的openshift不遵守package.json中我的服务器文件的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Node.js服务器,现在正在将其上传到OpenShift.我没有使用默认的./server.js文件,而是插入点是./bin/www.

I have been working on a Node.js server and am now uploading it to OpenShift. I am not using the default ./server.js file, but rather, my insertion point is ./bin/www.

我已将其设置为package.json中的插入文件,如下所示:

I have set this as the insertion file in package.json like so:

{
  "name": "NekoList",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "./bin/www"
...
},

我可以验证www在此目录./bin中,并且它是一个有效的javascript文件,在我的本地环境中运行得很好.

I can verify that www is in the ./bin this directory, and it is a valid javascript file that functions perfectly well on my local environment.

这是根据此处

但是,我可以从日志中得知OpenShift仍在尝试查找./server.js

However, I can tell from my logs that OpenShift is still trying to find ./server.js

这可能是怎么回事?我还能发布哪些其他有用的信息?

What might be going on here? What other information can I post that would be helpful?

注意:这与

Note: This is related to the problem in this thread, but, when I realized the problem was not actually a dependency issue, I decided to create a new thread for the real issue.

推荐答案

您正在使用"scripts"属性,但是在OpenShift上,您需要使用"main".这是因为OpenShift使用节点管理器来启动和管理Node.js应用程序.

You are using the "scripts" property, but on OpenShift you need to use "main" instead. This is because OpenShift uses node-supervisor to startup and manage your Node.js application.

这篇关于使用nodejs的openshift不遵守package.json中我的服务器文件的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆