0
0

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 3 years have passed since last update.

【徹底解説】React環境構築 〜 create-react-app

Last updated at Posted at 2020-10-31

Reactで初めてアプリを作る方向けの、環境構築 〜 アプリ立ち上げまでのフローを紹介します。

0.create-react-appに必要なもの

・node 8.10 以上
・npm 5.6 以上

1.Homebrewインストール

Homebrew とは macOS 用のパッケージマネージャーです。
Homebrew のサイト↓↓↓
https://brew.sh/index_ja

Homebrew をインストールします

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Homebrew がインストールされていることを確認します

$ brew -v

2.nodebrewインストール

Homebrew を使って nodebrew をインストールします

$ brew install nodebrew

nodebrew がインストールされていることを確認します

$ nodebrew -v

3.nodeインストール

nodebrew を使って node をインストールします

node の安定バージョンをインストール(create-react-appに必要なバージョンをインストール)

$ nodebrew install stable

node の最新バージョンをインストールしたい方はこちら

$ nodebrew install latest

インストール可能な node のバージョンを一覧で確認することもできます(バージョンを指定したいときに)

$ nodebrew ls-remote

バージョン一覧が表示されるので、任意のバージョン番号を以下の要領で指示する。(セットする)

$ nodebrew use vX.X.X

特に要求がない場合は安定バージョンをインストールしましょう

4.パスを通す

まだ node が使える状態になっていないので使えるようにする

zshの場合

$ echo export PATH=$HOME/.nodebrew/current/bin:$PATH >> ~/.zprofile

bashの場合

echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile

ターミナルを一度再起動しましょう

node がインストールされているか確認しましょう

$ node -v

node がインストールされていれば npm も自動的にインストールされています

$ npm -v

これで create-react-app を実行する準備が整いました

5.create-react-app

自分の開発ディレクトリで create-react-app を実行

$ npx create-react-app 作りたいフォルダ名

エラーが出ずに実行されればOK

お疲れ様でした。

参考サイト

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?