Reputation: 2302
I am trying to create application in which I used reactjs for frontend and Node.js for backend. I used concurrently package to start both application with single start. When I run that I get following errors...
> [email protected] final /Users/yashchoksi/Documents/express_checking
> concurrently "npm run server" "npm run client"
[0]
[0] > [email protected] server /Users/yashchoksi/Documents/express_checking
[0] > nodemon server.js
[0]
[1]
[1] > [email protected] client /Users/yashchoksi/Documents/express_checking
[1] > npm start --prefix client
[1]
[1]
[1] > [email protected] 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! [email protected] server: `nodemon server.js`
[0] npm ERR! Exit status 130
[0] npm ERR!
[0] npm ERR! Failed at the [email protected] 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! [email protected] final: `concurrently "npm run server" "npm run client" `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
I also try to deploy the same on Heroku but there also shows some errors...
My package.json file of Node.js
{
"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 file for client means ReactSide...
{
"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"
}
}
Please let me know solution , I also did following commands: npm --force cache clean
Thanks in advance....
Upvotes: 1
Views: 2505
Reputation: 11
I ran into this recently and the issue occurs because Nodemon exits with a 130 on SIGINT (Ctrl+C). You can see this in the code: https://github.com/remy/nodemon/blob/v2.0.4/lib/monitor/run.js#L450
Without getting into alternative ways to structure your project (e.g., monorepo, multiple repos, etc), you can downgrade to Nodemon v1.18.0 as the 130 exit code was added in v1.18.1. Note that this version of Nodemon uses an older version of Chokidar which itself uses FSEvents v1, which won't run on Node v14.
Another solution would be to not run Nodemon as part of your Concurrently script.
Finally, you can also just ignore the error since it's only going to ever happen when you hit Ctrl+C on your local computer during development.
Upvotes: 1