DEV Community

Prashant Ardeshana
Prashant Ardeshana

Posted on

#2 How to setup Next-React on your local system.

To install React with Next.js using the npx create-next-app@latest command, follow these steps:

1. Ensure Node.js is Installed

Before creating a Next.js project, you need to have Node.js installed on your system. Check if it's installed by running:

node -v
Enter fullscreen mode Exit fullscreen mode

If you don't have it installed, download and install it from Node.js official website.

2. Open a Terminal or Command Prompt

On Windows, open Command Prompt or PowerShell. On macOS or Linux, open a Terminal.

3. Navigate to the Folder Where You Want to Create the Project

Use the cd command to navigate to the folder where you'd like to create your new project. For example:

cd path/to/your/project/folder
Enter fullscreen mode Exit fullscreen mode

4. Run the npx create-next-app@latest Command

Now, run the following command:

npx create-next-app@latest
Enter fullscreen mode Exit fullscreen mode
  • This will prompt you with questions to configure your new Next.js project.
  • Example of questions and responses:
    • What is your project named?: Provide a project name (e.g., my-next-app).
    • Would you like to use TypeScript?: Choose Yes or No depending on your preference.
    • Would you like to use ESLint?: Choose Yes or No depending on whether you want linting enabled.
    • Would you like to use Tailwind CSS?: Choose Yes if you plan to use Tailwind for styling.
    • Would you like to use src/ directory?: Choose Yes or No.
    • Would you like to use App Router?: Choose Yes or No based on your preference.
    • Would you like to customize the default import alias?: Choose Yes or No.

Once you've answered all the prompts, the command will install all the necessary dependencies and create the project files.

5. Navigate to Your New Project Folder

After the installation is complete, navigate to the folder of your new Next.js project:

cd my-next-app
Enter fullscreen mode Exit fullscreen mode

Replace my-next-app with the actual name of your project.

6. Run the Development Server

To start the development server and see your new Next.js project in action, run:

npm run dev
Enter fullscreen mode Exit fullscreen mode

By default, your project will be accessible at http://localhost:3000.

7. Open the Project in Your Code Editor

Open your project folder in your preferred code editor, such as VS Code:

code .
Enter fullscreen mode Exit fullscreen mode

Now you have successfully created and set up a new Next.js (React) project!

Top comments (0)