简体   繁体   中英

when i run npm dev which is concurrently opens localhost 3000 which does not contain my project

"scripts": { "start": "react-scripts start", "server": "nodemon server ", "client": "npm start --prefix client ", "dev": "npx concurrently "npm run server" "npm run client""

This is the code on my server package json when I npm run dev it opens localhost 3000 which should have my frontend application but instead opens a new react app local host 3000

If I log into my frontend and run,it runs successfully on local host 3000 or sometimes claims that local host 3000 is occupied and changes the port number to local host 3001

I need For the npm run dev to open both client and server concurrently therefore opening the correct localhost 3000 which contains project interface

I believe you are trying to run both processes on the same PORT.Well it is not convenient to run two process on a single port concurrently you need to specify two distinct PORTs for each process.

Refer: Can two applications listen to the same port?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM