用于退出的命令是什么?(即终止Node.js进程)
当前回答
退出
let exitCode = 1;
process.exit(exitCode)
有用的退出代码
1 - Catchall for general errors 2 - Misuse of shell builtins (according to Bash documentation) 126 - Command invoked cannot execute 127 - “command not found” 128 - Invalid argument to exit 128+n - Fatal error signal “n” 130 - Script terminated by Control-C 255\* - Exit status out of range
其他回答
添加
process.exit(1);
会帮你的
我可以通过键入taskkill-F-IM node.exe,让我的所有节点进程直接从Windows 10上的Git Bash shell中消亡-这将立即结束我计算机上的所有节点过程。我发现我也可以使用taskkill//F//IM node.exe。不确定为什么-和//在这种情况下都有效。希望这有帮助!
在命令行中,.ext是您想要的:
$ node
> .exit
$
它记录在REPL文档中。REPL(Read Eval Print Loop)是Node命令行的名称。
在正常程序中,使用process.ext([code])。
打开运行节点应用程序的命令行终端,然后按Ctrl+C
如果要从代码中退出node js应用程序,
process.exit(); // graceful termination
process.exit(1); // non graceful termination
退出
let exitCode = 1;
process.exit(exitCode)
有用的退出代码
1 - Catchall for general errors 2 - Misuse of shell builtins (according to Bash documentation) 126 - Command invoked cannot execute 127 - “command not found” 128 - Invalid argument to exit 128+n - Fatal error signal “n” 130 - Script terminated by Control-C 255\* - Exit status out of range
推荐文章
- ReferenceError: description没有定义NodeJs
- 将一个二进制的NodeJS Buffer转换为JavaScript的ArrayBuffer
- AngularJS只适用于单页应用程序吗?
- 如何在vue-cli项目中更改端口号
- 同步和异步编程(在node.js中)的区别是什么?
- 如何编辑通过npm安装的节点模块?
- “node_modules”文件夹应该包含在git存储库中吗
- 使用package.json在全局和本地安装依赖项
- this.libOptions.parse不是一个函数
- 对嵌套文件夹运行npm install的最好方法是什么?
- 节点Multer异常字段
- 很好的初学者教程socket.io?
- CALL_AND_RETRY_LAST分配失败-进程内存不足
- 在Ubuntu上安装Node.js
- 使用express.js代理