Why? React projects use npm (Node Package Manager) to install dependencies. npm comes bundled with Node.js, so installing Node.js is all you need.
How to Install:
Open your terminal (Command Prompt on Windows, Terminal on macOS/Linux) and type:
If you see version numbers (like v16.14.0), then you have them installed. If not, follow the next steps.
Go to the official Node.js website https://nodejs.org/en
Download the LTS (Long Term Support) version, which is recommended for most users.
Windows: Run the downloaded installer and follow the prompts.
macOS: Open the downloaded .pkg file and follow the installation instructions.
Linux: Use your distribution’s package manager or download the binaries from the Node.js website. For example, on Ubuntu, you might run:
After installation, run:
You should see version numbers indicating that Node.js and npm are installed successfully.
Now that you have npm installed, you can clone your React project from GitHub.
Replace your-username/your-react-project with your repository’s actual URL.
cd your-react-project
In the project directory, run the following command to install all necessary packages:
This command reads the package.json file and downloads all the required dependencies.
Once the dependencies are installed, you can start the development server by running:
This command launches your React app in development mode.
Open http://localhost:3000 in your browser to view the app.
The app will automatically reload if you make any code changes.
Running Tests If your project includes tests, you can start the test runner with:
This launches tests in an interactive watch mode.
Building for Production When you're ready to deploy your app, build an optimized production version by running:
This creates a build folder with the minified, production-ready files.
You can then deploy these static files to your preferred hosting provider.
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify