gpt4 book ai didi

node.js - 使用 json-server + create-react-app 时,Node JS 不会使用 Ctrl+C 停止服务器

转载 作者:太空宇宙 更新时间:2023-11-04 01:47:02 26 4
gpt4 key购买 nike

我有一个示例 react 应用程序,我一直在搞乱它来构建一些小型的副项目。但我遇到了一个难题。 Ctrl+C 不会执行任何操作来停止我的应用程序。我必须手动通过任务管理器来杀死它。我已附上我的包 json。有一些包或方法吗?

{
"name": "practice-app",
"description": "Sample react app to practice different designs, tools and concepts",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^1.2.2",
"@material-ui/icons": "^1.1.0",
"concurrently": "^3.6.0",
"json-server": "^0.14.0",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "concurrently \"react-scripts start\" \"json-server --watch data/db.json --port 3001\"",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:3001"
}

最佳答案

也许尝试编写一个 npm stop 脚本?

"scripts": {
"start": "app.js",
"stop": "pkill --signal SIGINT myApp"
}

希望有帮助

关于node.js - 使用 json-server + create-react-app 时,Node JS 不会使用 Ctrl+C 停止服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51053175/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com