Frontend Development 6 min read

Setting Up a React Development Environment on macOS

This guide walks through installing Node.js, configuring npm with a Chinese mirror, and using create‑react‑app to quickly create and run a React project on macOS, including all necessary command‑line steps and code snippets.

Java Architect Essentials
Java Architect Essentials
Java Architect Essentials
Setting Up a React Development Environment on macOS

React is a JavaScript library originally created by Facebook to build the Instagram website and open‑sourced in May 2013.

The article explains how to set up a React development environment on macOS, starting with installing Node.js.

Download the Node.js .pkg installer from the official website, run it, and verify the installation with node -v and npm -v .

Because the default npm registry is slow in China, the guide suggests using the Taobao mirror either via cnpm or by configuring npm directly:

npm install -g cnpm --registry=https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org

If cnpm is unavailable, configure npm with the Taobao registry:

npm config set registry https://registry.npm.taobao.org

Install additional packages, for example:

npm install gulp less --save-dev

Use create-react-app to bootstrap a new project without manual configuration:

cnpm install -g create-react-app
create-react-app my-app
cd my-app/
npm start

Open a browser at http://localhost:3000/ to see the running app.

To run an existing React project cloned from Git, install its dependencies with:

npm install

and start the development server (if provided) with:

node server
frontendReactNode.jsmacOSnpmcreate-react-appSetup
Java Architect Essentials
Written by

Java Architect Essentials

Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.