Prerequisites
Install the following before starting:
- Node.js LTS (18+ recommended)
- npm (comes with Node) or pnpm/yarn
- VS Code or another editor
- Git
Check installation:
bash
node -v
npm -v
git --versionCreate a new React project
Use Vite for fast development and builds:
bash
npm create vite@latest my-react-app -- --template react-ts
cd my-react-app
npm install
npm run devOpen the URL printed in terminal (usually http://localhost:5173).
Important npm scripts
bash
npm run dev # start dev server
npm run build # production build
npm run preview # preview build output
npm run lint # lint checksRecommended editor setup
- ESLint extension
- Prettier extension
- TypeScript language support
- Path IntelliSense
Common setup issues
| Issue | Fix |
|---|---|
node not found | Reinstall Node and restart terminal |
| Port already in use | Run dev server with another port |
| Dependency install fails | Delete node_modules and lockfile, reinstall |
Your environment is ready. Next, learn project structure and file organization.