Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create-next-app using version 12 instead of latest version

I need to create a NextJS project for a Udemy course, but I need it to be NextJS version 12 instead of the latest version.

How can I do that?

like image 333
Alperen Avatar asked Dec 02 '25 15:12

Alperen


2 Answers

It's possible to setup Next.js version 12 manually:

# init the package.json
npm init
# intall next dependencies
npm install [email protected] react react-dom
// edit your package.json with next scripts
"scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start",
  "lint": "next lint"
}
# create the file structure
.
├── package.json
├── pages
│   ├── index.js
// init your index.js
import React from "react";

function index() {
  return <div>Hello world</div>;
}

export default index;
# start next
npm run dev
like image 129
devpolo Avatar answered Dec 05 '25 03:12

devpolo


Use the following commands (taken from here), replacing <app-name> with your actual app:

npx create-next-app@12 <app-name> && cd <app-name> && npm i next@12
like image 35
sashoalm Avatar answered Dec 05 '25 05:12

sashoalm