DEV Community

mugichaba
mugichaba

Posted on

Build React environment

Build 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
Enter fullscreen mode Exit fullscreen mode

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.

Install Node.js

To install Node.js, it would be better to setup the following softwares in this order.

  1. Homebrew ... Package manager for macOS.
  2. Nodebrew ... Version manager for Node.js.
  3. 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)"
Enter fullscreen mode Exit fullscreen mode

Install Nodebrew

It is also better to follow the official installing process.

Now, the command is:

$ brew install nodebrew
Enter fullscreen mode Exit fullscreen mode

After that, run the setup command.

$ nodebrew setup
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Then run the following command to reflect the setting.

$ source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Install Node.js

Last, install Node.js with the command.

nodebrew install stable
Enter fullscreen mode Exit fullscreen mode

By the way, you can see all the versions which are available to install.

nodebrew ls-remote
Enter fullscreen mode Exit fullscreen mode

If you don't have a preference about it, stable version is the best for now.

Install npm

It is installed with Node.js so let's see it.

$ npm -v
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)