Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
🟢 Basics – React + Next.js Foundation  ·  Lesson 02

Install Node.js & Create Next.js App

Tools you need

Node.jsruns JavaScript on PCnpm / npxinstalls packagescreate-next-appmakes the projectVS Codeedit the codeBrowserlocalhost:3000
Your Next.js development setup

Next.js runs on Node.js, the program that runs JavaScript outside the browser. Installing Node also gives you npm (package manager) and npx (run a package once).

Step 1: Install Node.js

  1. Open nodejs.org and download the LTS version for your system (Windows, macOS or Linux).
  2. Run the installer and keep the default options (make sure "Add to PATH" stays ticked on Windows).
  3. Open a new terminal (Command Prompt, PowerShell or Terminal) and check:
Terminal
node -v
npm -v
v22.12.0 10.9.0
💡 Next.js 16 needs Node.js 20.9 or newer. If node -v shows v18 or older, install the latest LTS.

Step 2: Install VS Code

Download Visual Studio Code from code.visualstudio.com. Useful extensions: ES7+ React snippets, Prettier (auto-format) and ESLint (shows mistakes).

Step 3: Create the app

Open a terminal in the folder where you keep projects (for example D:\projects) and run:

Terminal
npx create-next-app@latest my-first-app

Want the defaults without questions? Add --yes at the end. The defaults turn on TypeScript, Tailwind CSS, ESLint and the App Router.

The create-next-app questions

For this course choose customize settings and answer like this:

Terminal – answers used in this course
What is your project named? my-first-app
Would you like to use the recommended Next.js defaults?
    Yes, use recommended defaults - TypeScript, ESLint, Tailwind CSS, App Router, AGENTS.md
    No, reuse previous settings
  > No, customize settings - Choose your own preferences

Would you like to use TypeScript?                    No
Which linter would you like to use?                  ESLint
Would you like to use React Compiler?                No
Would you like to use Tailwind CSS?                  No
Would you like your code inside a `src/` directory?  No
Would you like to use App Router? (recommended)      Yes
Would you like to customize the import alias?        No   (keeps @/*)
Would you like to include AGENTS.md ...?             Yes
QuestionOur answerWhy
TypeScriptNoPlain JavaScript is easier while learning. You can switch later.
LinterESLintShows common mistakes in VS Code.
React CompilerNoAn optional optimiser; not needed for learning.
Tailwind CSSNoWe learn CSS Modules first; Tailwind has its own lesson.
src/ directoryNoKeeps app/ at the top level, like the docs.
App RouterYesThe modern router — this whole course uses it.
Import aliasKeep @/*Lets you write @/components/Header instead of ../../components/Header.

The tool now downloads Next.js, React and React DOM and creates a folder my-first-app.

Step 4: Run the development server

Terminal
cd my-first-app
npm run dev
▲ Next.js 16.3.8 (Turbopack) - Local: http://localhost:3000 - Network: http://192.168.1.5:3000 ✓ Starting... ✓ Ready in 1.2s

Open http://localhost:3000 in your browser — you will see the Next.js welcome page. The Network address lets you open the site on your phone if it is on the same Wi-Fi.

🔒 localhost:3000Hello Next.js 👋My first page. Today is Mon Oct 19 2026.

Step 5: Change the home page

Open the folder in VS Code (code .), open app/page.js, delete everything and paste:

JSX – app/page.js
// app/page.js — replace everything with this
export default function Home() {
  return (
    <main style={{ padding: 40, fontFamily: 'sans-serif' }}>
      <h1>Hello Next.js 👋</h1>
      <p>My first page. Today is {new Date().toDateString()}.</p>
    </main>
  )
}

Save the file. The browser updates instantly without a reload — this is called Fast Refresh.

npm scripts: dev, build, start

JSON – package.json (scripts part)
{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  }
}

npm run dev

  • For coding
  • Fast Refresh on save
  • Shows detailed error overlay
  • Not optimised

npm run build + npm start

  • For the live website
  • build makes optimised files in .next/
  • start runs the production server
  • Much faster for visitors
Development vs production

In Next.js 16, Turbopack is used automatically for both dev and build, so you no longer write --turbopack.

Common errors and fixes

  • 'node' is not recognized — Node is not on PATH. Reinstall Node and open a new terminal.
  • "Node.js version ... is required" — your Node is too old. Install the latest LTS.
  • Port 3000 is in use — stop the other server (Ctrl + C) or run npm run dev -- -p 3001.
  • Project name with capital letters or spaces — npm package names must be lowercase, e.g. my-first-app.
  • Editing the wrong file — with the App Router the home page is app/page.js, not pages/index.js.

Summary

  • Install Node.js 20.9+ and VS Code.
  • Create a project with npx create-next-app@latest.
  • Run npm run dev and open localhost:3000.
  • app/page.js is the home page; saving updates the browser instantly.
✅ Practice

Change the heading to your name, add a <ul> with three things you want to build, and open the site on your phone using the Network address.

Frequently Asked Questions

Which Node.js version does Next.js 16 need?
Node.js 20.9 or newer. Install the current LTS version from nodejs.org and check it with node -v.
Should I choose TypeScript or JavaScript?
The recommended defaults use TypeScript. This course uses plain JavaScript (.jsx) so beginners can focus on Next.js; everything works the same in TypeScript.
What does npx do?
npx runs a package without installing it globally. npx create-next-app@latest downloads the latest project generator, runs it once and leaves nothing behind.
Why is port 3000 already in use?
Another dev server is still running. Stop it with Ctrl + C in its terminal, or start on another port with npm run dev -- -p 3001.
← Next.js Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

Next topicNext.js Project Structure Your progress: 2 / 37 (5%) · Lesson 3 / 37 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free