永远使用 npm start 和环境变量 [英] Forever with npm start and environment variable

查看:42
本文介绍了永远使用 npm start 和环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经使用以下方法启动我的应用程序:

I used to start my application using:

DEBUG=chakka ENVIRONMENT=production npm start

我怎样才能永远使用它,这样我就不必每次想测试应用程序时都这样做?谢谢!

How can i start it using forever so i wouldn't have to do it everytime i want to test the application? Thanks!

推荐答案

首先你需要知道应用程序的主脚本文件是什么.打开您的 package.json 文件并找出 start 脚本是什么.如果您使用 Express,它可能是 app.js.所以我们假设在这个例子中使用 app.js,替换为你的任何文件.

First you need to know what the application's main script file is. Open up your package.json file and find out what the start script is. If you're using Express it might be app.js. So we'll assume app.js for this example, replace with whatever your file is.

启动应用程序:

DEBUG=chakka ENVIRONMENT=production forever start app.js

在您进行更改后重新启动应用程序:

to restart the application after you've made changes:

forever restart app.js

这篇关于永远使用 npm start 和环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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