在本地计算机中运行服务器,而无需显示CMD窗口

发布于 2025-02-01 01:39:44 字数 155 浏览 3 评论 0原文

我使用Express创建了我的Node.js应用程序,现在我想将其上传到本地服务器计算机上。 我已经创建了一个BAT文件(我将使用任务计划者运行此功能),该文件基本上移至文件夹应用程序并启动“ NPM运行启动”。

问题是:有一种更正确的方法吗? (没有云),是否可以隐藏CMD窗口?

I' ve created my node.js app with express, now i want to upload it on my local server machine.
I've created a bat file (I will use task planner to run this) that basically move to folder app and launch "npm run start".

The question is: There's a more correct way to this? (no cloud) and is it possible to hide the cmd window?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耶耶耶 2025-02-08 01:39:44

可以使用

只需在计算机上全球安装PM2:

$ npm install pm2 -g

然后使用PM2启动您的应用程序:

$ pm2 start app.js

您可以做一些配置,所以我建议您查看他们的 repo

Putting a node.js application to production can be done with pm2. Pm2 will spin up your application and keep it alive, without having any terminal/cmd open.

Simply install pm2 globally on your machine:

$ npm install pm2 -g

Then launch your application with pm2:

$ pm2 start app.js

There are some configurations you could do, so I suggest you look at their repo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文