1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Amazon Linux:node.jsからAngularのサンプルアプリ作成まで

Last updated at Posted at 2017-10-05

いろいろてこずったので以下に纏めました。一発で動くはずです。

node

インストール

cd /tmp
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs
sudo yum -y install gcc-c++ make

バージョン確認

node -v
v8.6.0

npm -v
5.3.0

npmのデフォルトディレクトリ変更

これを実施しないとAngularのインストールが失敗する。
参考URL:https://qiita.com/okoysm/items/ced3c3de30af1035242d
@okoysmさん、ありがとうございます)

cd
mkdir .npm-global
npm config set prefix '~/.npm-global'
vi .bash_profile

PATHを通す

.bash_profile
- PATH=$PATH:$HOME/.local/bin:$HOME/bin
+ PATH=~/.npm-global/bin:$PATH:$HOME/.local/bin:$HOME/bin

.bash_profileを再読込してパスを有効化

source .bash_profile

Angular

インストール

npm install -g @angular/cli

アプリ作成

こちらの内容です:https://angular.io/guide/quickstart

ng new my-app

ng serve実行

cd my-app
ng serve --host=0.0.0.0 --public=グローバルIPもしくはFQDN

EC2

4200番ポートへの接続を許可する

image.png

確認

をブラウザで開く

1
4
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
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?