How to change angular port from 4200 to any other

后端 未结 29 1864
心在旅途
心在旅途 2020-12-04 05:59

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         


        
29条回答
  •  青春惊慌失措
    2020-12-04 06:13

    It seems things have changed in recent versions of the CLI (I'm using 6.0.1). I was able to change the default port used by ng serve by adding a port option to my project's angular.json:

    {
        "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
        "projects": {
            "my-project": {
                "architect": {
                    "serve": {
                        "options": {
                            "port": 4201
                        }
                    }
                }
            }
        }
    }
    

    (Only relevant properties are shown in this example.)

提交回复
热议问题