【发布时间】:2018-01-14 14:19:07
【问题描述】:
我启动了一个 React 应用程序 npm 开始 在 package.json 中定义 start:
{
"name": "testreactapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-scripts": "1.0.10"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
我现在想停止它,而不关闭终端。我该怎么做?
试过了: npm stop testrectapp 但这会引发需要脚本的错误
然后尝试: npm run stop 使用脚本“stop”:“pkill --signal SIGINT testreactapp” 抛出错误“pkill 未被识别为命令”
编辑:
在 bash 中运行 ps 显示:
PID PPID PGID WINPID TTY UID STIME COMMAND
6652 1 6652 6652 ? 197612 19:52:49 /usr/bin/mintty
1092 1 1092 1092 ? 197612 Jul 25 /usr/bin/mintty
11092 6652 11092 10060 pty1 197612 19:52:49 /usr/bin/bash
13868 1092 13868 992 pty0 197612 Jul 25 /usr/bin/bash
11428 13868 11428 17340 pty0 197612 12:48:27 /usr/bin/ps
11672 1092 1092 11672 ? 197612 Jul 25 /usr/bin/mintty <defunct>
那里看不到应用程序?
【问题讨论】:
-
为什么不直接在终端打
Ctrl+C? -
@SatishPatel 它并不总是终止进程。
标签: javascript node.js reactjs react-scripts pkill