小编典典

运行react-scripts后如何停止?

reactjs

我用npm start来启动一个React应用,其中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,但是会抛出错误,需要脚本

然后尝试:使用脚本“ stop”运行npm run 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>那里没有看到该应用程序?


阅读 1293

收藏
2020-07-22

共1个答案

小编典典

点击键盘快捷键以停止终端命令(通常是Ctrl + C或Ctrl + Q)

或者,如果您没有对该进程的输入访问权限,请确定其PID并杀死它:

在Windows上:

C:\>Taskkill /PID <PID> /F

在Linux上:

$>kill -SIGTERM <PID>
2020-07-22