19
Build React environment
I will build the environment with macOS Catalina.
Before we start, we need Node >= 14.0.0
and npm >= 5.6
.
I have already had node and npm in my computer though if you need to install it, follow the steps below.
If you are not sure whether node and npm are in your computer or not, try the following commands.
$ node -v
If it shows like -bash: node: command not found
, you should follow the next steps.
If it shows some version like v14.17.0
, you don't have to install them.
To install Node.js, it would be better to setup the following softwares in this order.
- Homebrew ... Package manager for macOS.
- Nodebrew ... Version manager for Node.js.
- Node.js
Install Homebrew
Following the latest install commands on the official website is the best.
Now, the command is below:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Nodebrew
It is also better to follow the official installing process.
Now, the command is:
$ brew install nodebrew
After that, run the setup command.
$ nodebrew setup
The result will show that a command like export PATH=$HOME/.nodebrew/current/bin:$PATH
, then run the following command.
$ echo 'THE_COMMAND_ABOVE' >> ~/.bash_profile
Then run the following command to reflect the setting.
$ source ~/.bash_profile
Install Node.js
Last, install Node.js with the command.
nodebrew install stable
By the way, you can see all the versions which are available to install.
nodebrew ls-remote
If you don't have a preference about it, stable version is the best for now.
It is installed with Node.js so let's see it.
$ npm -v
It must show the version like 6.14.13
(it is my result).
I was supposed to get to creating my first React app though this description became longer than I thought.
I will write about it in the next article.
19