In this article, I will be walking you through the full ReactJS installation process on MacOS in detail. I will be covering:
- NodeJS and NPM installation.
- ReactJS library installation.
- Creating a ReactJS project.
Once you've downloaded NodeJS through their website, you should find the downloaded ".pkg" file inside of your downloads folder. Simply open this ".pkg" file by double-clicking on it and you will be prompted with a pop-up containing info about the NodeJS and NPM installation process.
Click on "Install", or if you want to change the install location, click on "Change Install Location". This will start the NodeJS and NPM installation process. Once finished, you will be prompted with a final message displaying the location where NodeJS and NPM are installed.
As stated in the pop-up, to have access to NodeJS and NPM from your project's directory, make sure that "/usr/local/bin" is in your project's "$PATH". To add "/usr/local/bin" to your "$PATH" on MacOS, run the following command in your project's terminal:
You can then click "Close" to close the pop-up.
To check if both NodeJS and NPM were installed successfully, in your project's terminal, run:
This will return your NodeJS and NPM versions.
Now that you have NodeJS and NPM installed, You should now be able to install ReactJS in your project's directory by running:
npm install --save react react-dom
Now that you have ReactJS installed, you can create a new react project directory by running:
npx create-react-app my-react-project
You can then open a terminal window inside of this react project by running:
Once you're inside a terminal window inside of this react project, you can finally run the following command to start a development server on "localhost:3000":