🔧 #2 How to setup Next-React on your local system.
Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to
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
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
4. Run the npx create-next-app@latest
Command
Now, run the following command:
npx create-next-app@latest
- 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
orNo
depending on your preference. -
Would you like to use ESLint?: Choose
Yes
orNo
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
orNo
. -
Would you like to use App Router?: Choose
Yes
orNo
based on your preference. -
Would you like to customize the default import alias?: Choose
Yes
orNo
.
-
What is your project named?: Provide a project name (e.g.,
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
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
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 .
Now you have successfully created and set up a new Next.js (React) project!
...