如何在Open Shift中修改节点启动命令? [英] How do I modify the node startup command in Open Shift?

查看:111
本文介绍了如何在Open Shift中修改节点启动命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有babel-node的ES6来创建我的应用程序,我需要我的应用程序以命令 babel-node app.js 开头。该命令在脚本中列出:在我的package.json中启动,所以命令npm start运行正确的命令。

I'm using ES6 with babel-node to create my app and I require my app to start with the command babel-node app.js. This command is listed in scripts: start in my package.json so the command npm start runs the correct command.

打开移位启动节点应用程序,节点+在您的package.json文件的主属性中设置脚本。在我的情况下,它的main:app.js。所以这个命令是运行 node app.js

Open shift starts node apps with node + what ever script is set in the main property of your package.json file. In my case its "main": "app.js". So this command is run node app.js.

服务器在遇到的第一个ES6上窒息,这是有道理的。我不知道如何配置openshift以运行 babel-node 或npm开始启动我的应用程序。

The server is choking on the first ES6 it encounters which makes sense. I can't figure out how to configure openshift to run babel-node or npm start to start up my app.

这是我的package.json文件 - > https://gist.github.com/jkinman/2cc57ce5fae5817d6bca

Here is my package.json file -> https://gist.github.com/jkinman/2cc57ce5fae5817d6bca

推荐答案

您不应该使用 babel-node ,这是内存密集型,不是用于生产。相反,您应该通过创建文件开始使用需要钩子。 js (name unimportant)with the following content:

You shouldn't run your server with babel-node, which is memory intensive and not meant for production. Instead, you should use the require hook by creating a file start.js (name unimportant) with the following content:

require('babel-core/register')
require('./app.js')
// or server.js or whatever you use to normally start you app

然后,您可以使用 node start.js 启动服务器。

Then you can start your server with node start.js.

这篇关于如何在Open Shift中修改节点启动命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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