DEV Community

Hafiz Saifullah
Hafiz Saifullah

Posted on

Now both Express and React servers are running by single `npm run dev` command

I was facing a problem. I wanted to run both frontend and backend servers using single command npm run dev, but it was not working.

Issue Resolved by installing concurrently using
npm i concurrently --save

and changing dev script by
"dev": "concurrently \"npm run dev-client\" \"nodemon index.js\""

now I am getting Fine result as below...

$ npm run dev

> crypto@1.0.0 dev C:\Users\Education Use\crypto
> concurrently "npm run dev-client" "nodemon index.js"

[1] [nodemon] 2.0.4
[1] [nodemon] to restart at any time, enter `rs`
[1] [nodemon] watching path(s): *.*
[1] [nodemon] watching extensions: js,mjs,json
[1] [nodemon] starting `node index.js`
[0] 
[0] > crypto@1.0.0 dev-client C:\Users\Education Use\crypto
[0] > npm run clean && parcel client/src/index.html --out-dir client/dist
[0] 
[1] listening at localhost: 3000
[0] 
[0] > crypto@1.0.0 clean C:\Users\Education Use\crypto
[0] > rm -rf .cache client/dist
[0] 
[0] Server running at http://localhost:1234 
Error: ENOENT: no such file or directory, stat 'C:\Users\Education Use\crypto\client\dist\index.html'
[1] [nodemon] restarting due to changes...
[1] [nodemon] restarting due to changes...
[1] [nodemon] restarting due to changes...
[1] [nodemon] restarting due to changes...
[0] ✨  Built in 51.89s.
[1] [nodemon] starting `node index.js`
[1] listening at localhost: 3000
Enter fullscreen mode Exit fullscreen mode

Thanx a lot for all of those Who granted their kind consideration.

Top comments (5)

Collapse
 
java_warrior profile image
Kingsley Victor

Could you describe what error you're getting if there's one?

Collapse
 
hafizsaifullah profile image
Hafiz Saifullah

only front end server was running. but now has been resolved the issue by installing concurrently using npm i concurrently --save and changing dev script by
"dev": "concurrently \"npm run dev-client\" \"nodemon index.js\""

Collapse
 
hafizsaifullah profile image
Hafiz Saifullah

Thanx a lot for your kind response, that is a lot for me.
Thank you @Kingsley

Collapse
 
mkubdev profile image
Maxime Kubik

I suggest you to use pm2 to deamon your second command.

Collapse
 
hafizsaifullah profile image
Hafiz Saifullah • Edited

Issue has been resolved by installing concurrently using npm i concurrently --save and changing dev script by
"dev": "concurrently \"npm run dev-client\" \"nodemon index.js\""

Thanx a lot for your kind response, that is a lot for me.
Thank you @Kubdev