LoginSignup
4
3

More than 5 years have passed since last update.

angular-cli-ghpagesを使ってみた(ng github-pages:deployが動かなくなった)

Posted at

0. ng github-pages:deploy が動かない

ng github-pages:deploy
The specified command github-pages:deploy is invalid. For available options, see `ng help`.

angular-cliを利用してgithub.ioに作ったangularアプリをdeployしたいときに、多分、こういうエラーが出る例が増えて来ていると思う。

angular-cliはこのオプションのサポートをやめたのかもしれない。
その代わり、最近angular-cli-ghpagesというツールが出た。

1. 代わりにangular-cli-ghpagesを使おう!

現在の自分の環境はこういう感じ。

ng --version

@angular/cli: 1.0.0-rc.0
node: 7.7.2
os: darwin x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.9

angular-cli-ghpagesのREADMEに書いてある通りにアプリをビルドして、デプロイしてみた。

ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
angular-cli-ghpages [OPTIONS]
  • Successfully published!とプロンプトに表示されて、github.ioにアクセスすると、angular2 tutorialで作ったアプリが動いていた。
  • angular-cli-ghpagesの代わりにnghという短縮コマンドでも使えるようです。こっちの方が楽。
  • というわけでこれからはnghですね。
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3