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.
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.orgIf cnpm is unavailable, configure npm with the Taobao registry:
npm config set registry https://registry.npm.taobao.orgInstall additional packages, for example:
npm install gulp less --save-devUse 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 startOpen 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 installand start the development server (if provided) with:
node serverJava 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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.