Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
4
Help us understand the problem. What is going on with this article?
@daikiojm

angular-cliで開発サーバーのポート番号変更

More than 1 year has passed since last update.

確認した環境

$ ng --version
@angular/cli: 1.3.0
node: 8.1.3
os: darwin x64

上記バージョンのangular-cliで作成した、angularプロジェクトが対象です。

変更する

.angular-cli.jsonのdefaults->serve->portの項目を編集します。
angular-cliで作成した直後の状態だと項目自体がないので、追加します。
下記の例では、デフォルトの4200から4201に変更しています。

変更前

.angular-cli.json
...
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

変更後

.angular-cli.json
...

  "defaults": {
    "styleExt": "css",
    "component": {},
    "serve": {
      "port": 4201
    }
  }
}

確認

$ ng serve

次のように、変更したポート番号で開発サーバーが起動していることが確認出来ると思います。

スクリーンショット_2017-09-08_16_01_44.png

4
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
daikiojm
https://daikiojm.me/

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
4
Help us understand the problem. What is going on with this article?