I want to use 5000 instead of 4200.
I have tried to create a file on root name ember-cli
and put JSON according to the code below:
{
&q
No one has updated answer for latest Angular CLI.With latest Angular CLI
With latest version
of angular-cli in which angular-cli.json renamed to angular.json
, you can change the port by editing angular.json
file
you now specify a port per "project"
projects": {
"my-cool-project": {
... rest of project config omitted
"architect": {
"serve": {
"options": {
"port": 4500
}
}
}
}
}
Read more about it here
you can also enter the below command in your angular cli where you normally enter npm start
ng serve --host "ip-address" --port "port-number"
Although there are already numerous valid solutions in the above answers, here is a visual guide and specific solution for Angular 7 projects (possibly earlier versions as well, no guarantees though) using Visual Studio Code. Locate the schema.json in the directories as shown in the image tree and alter the integer under port --> default for a permanent change of port in the browser.
simply run ng serve --port 5000 --open
Just Run
ng serve --port yourport
Example:
ng serve --port 4401
In angular.json:
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "projectname:build",
"port": 5000
}
I am using angular-cli. This worked for me.