Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the server port from 3000?

Tags:

I just ended the tutorial of Angular 2 and I can't find a way to change the localhost port from 3000 to 8000. In my package.json file there's the line "start": "concurrent \"npm run tsc:w\" \"npm run lite\" " that I believe is related but I'm not sure.

like image 278
Jp_ Avatar asked Feb 16 '16 19:02

Jp_


People also ask

How do I change the react port on 3000?

In ReactJS, the easiest way to alter the port number is by setting an environment variable named PORT to the desired number via the terminal. As an example, here we change the port number to 5000. your local server will run on port 5000.

How can we stop port 3000?

You can stop process with ctrl+C in the terminal window.

How do I change my json server port number?

json , you can change the port inside the lite-server module. Go to node_modules/lite-server/lib/config-defaults. js in your project, then add the port in "modules. export" like this.


2 Answers

You can change it inside bs-config.json file as mentioned in the docs https://github.com/johnpapa/lite-server#custom-configuration

For example,

{   "port": 8000,   "files": ["./src/**/*.{html,htm,css,js}"],   "server": { "baseDir": "./src" } } 
like image 147
Kalman Avatar answered Oct 07 '22 00:10

Kalman


Using Angular 4 and the cli that came with it I was able to start the server with $npm start -- --port 8000. That worked ok: ** NG Live Development Server is listening on localhost:8000, open your browser on http://localhost:8000 **

Got the tip from Here

enter image description here enter image description here

like image 26
Hodglem Avatar answered Oct 07 '22 01:10

Hodglem