Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript node.js和react应用程序中并发命令时出错?_Javascript_Node.js_Reactjs_React Native - Fatal编程技术网

Javascript node.js和react应用程序中并发命令时出错?

Javascript node.js和react应用程序中并发命令时出错?,javascript,node.js,reactjs,react-native,Javascript,Node.js,Reactjs,React Native,我正在尝试创建一个应用程序,其中我使用reactjs作为前端,Node.js作为后端。我使用并发包以单启动方式启动这两个应用程序。当我运行时,我得到以下错误 > express_checking@1.0.0 final /Users/yashchoksi/Documents/express_checking > concurrently "npm run server" "npm run client" [0] [0] > express_checking@1.0.0 s

我正在尝试创建一个应用程序,其中我使用reactjs作为前端,Node.js作为后端。我使用并发包以单启动方式启动这两个应用程序。当我运行时,我得到以下错误

> express_checking@1.0.0 final /Users/yashchoksi/Documents/express_checking
> concurrently "npm run server" "npm run client" 

[0] 
[0] > express_checking@1.0.0 server /Users/yashchoksi/Documents/express_checking
[0] > nodemon server.js
[0] 
[1] 
[1] > express_checking@1.0.0 client /Users/yashchoksi/Documents/express_checking
[1] > npm start --prefix client
[1] 
[1] 
[1] > client@0.1.0 start /Users/yashchoksi/Documents/express_checking/client
[1] > react-scripts start
[1] 
[0] [nodemon] 1.18.3
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching: *.*
[0] [nodemon] starting `node server.js`
[1] Starting the development server...
[1] 
[0] Success, mlab DB connected.
[1] Compiled successfully!
[1] 
[1] You can now view client in the browser.
[1] 
[1]   Local:            http://localhost:3000/
[1]   On Your Network:  http://192.168.0.102:3000/
[1] 
[1] Note that the development build is not optimized.
[1] To create a production build, use yarn build.
[1] 
^C[0] npm ERR! code ELIFECYCLE
[0] npm ERR! errno 130
[0] npm ERR! express_checking@1.0.0 server: `nodemon server.js`
[0] npm ERR! Exit status 130
[0] npm ERR! 
[0] npm ERR! Failed at the express_checking@1.0.0 server script.
[0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0] 
[0] npm ERR! A complete log of this run can be found in:
[0] npm ERR!     /Users/yashchoksi/.npm/_logs/2018-08-18T17_38_22_635Z-debug.log
[1] npm run client exited with code 0
[0] npm run server exited with code 130
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express_checking@1.0.0 final: `concurrently "npm run server" "npm run client" `
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the express_checking@1.0.0 final script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yashchoksi/.npm/_logs/2018-08-18T17_38_22_689Z-debug.log
我也尝试在Heroku上部署相同的功能,但也显示了一些错误

> express_checking@1.0.0 final /Users/yashchoksi/Documents/express_checking
> concurrently "npm run server" "npm run client" 

[0] 
[0] > express_checking@1.0.0 server /Users/yashchoksi/Documents/express_checking
[0] > nodemon server.js
[0] 
[1] 
[1] > express_checking@1.0.0 client /Users/yashchoksi/Documents/express_checking
[1] > npm start --prefix client
[1] 
[1] 
[1] > client@0.1.0 start /Users/yashchoksi/Documents/express_checking/client
[1] > react-scripts start
[1] 
[0] [nodemon] 1.18.3
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching: *.*
[0] [nodemon] starting `node server.js`
[1] Starting the development server...
[1] 
[0] Success, mlab DB connected.
[1] Compiled successfully!
[1] 
[1] You can now view client in the browser.
[1] 
[1]   Local:            http://localhost:3000/
[1]   On Your Network:  http://192.168.0.102:3000/
[1] 
[1] Note that the development build is not optimized.
[1] To create a production build, use yarn build.
[1] 
^C[0] npm ERR! code ELIFECYCLE
[0] npm ERR! errno 130
[0] npm ERR! express_checking@1.0.0 server: `nodemon server.js`
[0] npm ERR! Exit status 130
[0] npm ERR! 
[0] npm ERR! Failed at the express_checking@1.0.0 server script.
[0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0] 
[0] npm ERR! A complete log of this run can be found in:
[0] npm ERR!     /Users/yashchoksi/.npm/_logs/2018-08-18T17_38_22_635Z-debug.log
[1] npm run client exited with code 0
[0] npm run server exited with code 130
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! express_checking@1.0.0 final: `concurrently "npm run server" "npm run client" `
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the express_checking@1.0.0 final script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yashchoksi/.npm/_logs/2018-08-18T17_38_22_689Z-debug.log
Node.js的My package.json文件

{
  "name": "express_checking",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
    "server": "nodemon server.js",
    "client": "npm start --prefix client",
    "cinstall": "npm install --prefix client",
    "final": "concurrently \"npm run server\" \"npm run client\" "
  },
  "author": "Yash Choksi",
  "license": "ISC",
  "devDependencies": {
    "body-parser": "^1.18.3",
    "concurrently": "^3.6.1",
    "express": "^4.16.3",
    "mongoose": "^5.2.9",
    "nodemon": "^1.18.3"
  },
  "dependencies": {}
}
客户端的My package.json文件意味着

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.4.2",
    "react-dom": "^16.4.2",
    "react-scripts": "1.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "axios": "^0.18.0"
  }
}
请让我知道解决方案,我还执行了以下命令: npm—强制缓存清理


提前感谢….

我最近遇到了这个问题,因为Nodemon退出时带有130 on SIGINT(Ctrl+C)。您可以在代码中看到这一点:

无需采用其他方式来构建项目(例如,单回购、多回购等),您可以降级到Nodemon v1.18.0,因为130退出代码已添加到v1.18.1。请注意,此版本的Nodemon使用较旧版本的Chokidar,它本身使用FSEvents v1,不会在节点v14上运行

另一个解决方案是不将Nodemon作为脚本的一部分运行


最后,您也可以忽略此错误,因为只有在开发过程中在本地计算机上按Ctrl+C时才会发生此错误。

他们可能同时作为CI测试套件的一部分使用,在这种情况下,错误可能出现在服务器上,并被解释为失败。说句公道话,James。但是,请记住,错误发生在SIGINT(键盘中断)上。在粘贴的端子输出中,可以看到“^C”(ctrl-C)。在我脑子里,我不知道CI平台向进程发送什么信号来阻止它,但我很可能会发出一个信号,可能是SIGTERM或SIGKILL。同样截至2021年5月,SIGINT上的130退出代码仍在Nodemon的代码中,因此显然不是他们要删除的优先事项。TL;DR:这是一个功能,不是一个bug;)我不能再编辑我的最后一条评论,但我只想补充一点,在CI中运行Nodemon将是一个非常利基的用例,这是一种政治上正确的说法,表明你永远不会这么做。