In my localhost, running below command
PORT=4080 node server.js
But, it was throwing an unexpected error.
\'PORT\' is no
You can try this way also
"scripts": {
"build": "concurrently \"cd client && npm build\" \"cd server && npm build\"",
"install": "(cd client && npm) && (cd server && npm)",
"start": "concurrently \"cd client && SET PORT=3000 && npm start\" \"cd server && SET PORT=3001 && npm start\"",
"start:prod": "cd server && npm start:prod"
}
SET PORT=8090 && nodemon server.js
that worked for me
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.
automatically run this port :3000,I tried windows working react
"devDependencies": {
"react-scripts": "0.8.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
Here's a moronic way I found to recreate this problem:
npm install
npm start
Receive error described in question.
PORT=3006
and save it in your project directory.