Two parts:
What npm does:
npm install react
react packagenode_modules/ folderpackage.json to track dependencyCommon npm commands:
| Command | What it does |
|---|---|
npm init -y |
Creates package.json |
npm install <package> |
Downloads and saves a package |
npm install |
Downloads all packages from package.json |
npm install -D <package> |
Install as dev dependency |
npm run dev |
Runs script from package.json |
npm run build |
Creates production build |
npm create vite@latest
# Select: React
# Select: JavaScript
cd your-project-name
npm install
npm run dev
Step 1: Create folder and initialize
mkdir react-app
cd react-app
npm init -y