nohup npm开始终止

问题描述

我正在尝试使用此命令在后台运行我的reactjs项目。

nohup npm start > /dev/null 2>&1 &

输出应该被重定向,并且nohup意味着在stty被切断时不要终止进程。 但是我的npm节点根本没有运行。这是来自nohup日志。


Starting the development server...

events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: EBADF: bad file descriptor,read
Emitted 'error' event on ReadStream instance at:
    at internal/fs/streams.js:202:14
    at FSReqCallback.wrapper [as oncomplete] (fs.js:528:5) {
  errno: -9,code: 'EBADF',syscall: 'read'
}

解决方法

您可以使用forever。您可以从链接中检查更多高级方案。下面是使用它的最简单方法

sudo npm install forever -g

然后

forever start app.js

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...