Road to fullstack(MERN)

Know your way around YARN package as no much documentation is released about it. Get to know how to…

Follow publication

Set a new port for React js(Yarn)

Hello reader!

For quite a while now, React has being using a default PORT 3000 to run and if you are familiar with this you’ll know it’s quite annoying. Most of the time I have my PORT 3000 always busy so I get a prompt in my command line to use another port(y/n prompt).

The issue I have with this is when I try using both backend and frontend together(using concurrently) I get port error. This time around, you will definitely be unable to run your React frontend because there will be no prompt for you to use another port instead of the default 3000. But worry no more as I’ve got you covered here.

The crash error log
port error log

Not to beat around the bush, let’s go straight to how we can get rid of this annoying error.

Magic moment: All you need to do is just specify the port and you’re good to go. How do you do that? Open the package.json in your frontend, navigate to scripts, then add the code below, behind the “start”

PORT=8000

port error solved

Now, feel free to change to whatever port you wanna use, not necessarily PORT 8000.

There you have it, port error solved without sweat.

Thank you for taking your time to read through this post. If you found it helpful, please give it a clap. Bye

Sign up to discover human stories that deepen your understanding of the world.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Road to fullstack(MERN)
Road to fullstack(MERN)

Published in Road to fullstack(MERN)

Know your way around YARN package as no much documentation is released about it. Get to know how to set it up without having to changing to NPM

Samuel Lucas
Samuel Lucas

Written by Samuel Lucas

Writer and developer based in Nigeria. On Medium, I write about JavaScript and web development 💻

No responses yet

Write a response