In my localhost, running below command
PORT=4080 node server.js
But, it was throwing an unexpected error.
'PORT' is not recognized as an internal or external command, operable program or batch file.
Do I need to install any module or did I miss any syntax to run it properly?
Apart from cross-env, Below command can serve the purpose.
SET PORT=4080 && node server.js
PS: Set environment variable for nodeJs, run command in project folder.
In Windows you can set scripts in package.json
:
"start": " set PORT=portnumber && react-app-rewired start"
or
"start": " set PORT=3001 && react-script start".
It worked for me:
PORT=3006
and save it in your project directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With