Node.js Port 3000 already in use but it actually isn't?

前端 未结 30 2139
闹比i
闹比i 2020-11-28 17:24

I have been working with a node.js project for a few weeks and it has been working great. Usually, I use npm start to run my app and view it in a browser on loc

30条回答
  •  离开以前
    2020-11-28 18:15

    Try opening the localhost in your browser. Just type: localhost:3000 in the address bar.

    If the app opens-up, it means your previous npm run is still active. Now, you can just make changes to the code and see the effects if you are designing the same app, or if you wanna run another app, just tweak the code (in index.js of previously running app) a little-bit and (probably refresh the browser tab) to make it crash ;)..... Now go run npm run start again from your new app directory. Hope this helps! :)

    or

    You can open the Task Manager (WINDOWS_KEY+X > Task Manager) and you'll see the "Node.js:Server-side JavaScript" row. Select that and end task....It should work now!!



    If not, change the .env file of your app to include port:3002 and run the new app. This will allow you to run two separate apps on different ports. Cheers!!

提交回复
热议问题