Angular change port 4200 (Angular 2+)

7 points
Created by:

Quick solution:

ng serve --port 4201

Default port that angular will start is 4200.

We can add this to package.json:

"start": "ng serve --port 4201",

Example - part of package.json file from angular project

  "name": "test",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "ng": "ng",
    "start": "ng serve --port 4201",    <----------------------------- this line
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"


  • File: package.json can be found on root level of our angular project.
  • Chaning port from 4200 to some other may be useful when we want to run second instance of our angular app on the same machine or the default port 4200 is already in use by some other application.
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂