Sling Academy
Home/Next.js/How to Create a Next.js App in the Current Directory

How to Create a Next.js App in the Current Directory

Last updated: January 14, 2023

You can initialize a new Next.js app in the current directory by using a dot (.) for the path when running the npx create-next-app command. There is a mandatory requirement is that the name of the current folder must not contain special characters, spaces, or capital letters.

npx create-next-app .

I ran the command above inside a folder named example, and here’s what I got:

In recent versions of Next.js, it will ask if you want to use TypeScript and ESLint:

Would you like to use TypeScript with this project? … No / Yes
Would you like to use ESLint with this project? … No / Yes

Just select No or Yes and then press the Enter (or Return) key.

If no questions appear, you can also create a Next app with TypeScript by adding either the –ts or –typescript flag:

npx create-next-app . --typescript

After the initialization is complete, you can boot your project up by running the following command (without switching directories):

npm run dev

That’s it. Happy coding!

Previous Article: How to mock Next.js router in Jest tests

Series: Next.js: Configuration & Deployment

Next.js

Related Articles

You May Also Like

  • Solving Next.js Image Component Error with CSS Classes
  • How to Use MUI (Material UI) in Next.js 14
  • Fixing Data Update Issues in Next.js Production
  • Fixing Next.js Undefined ENV Variables in Production Build
  • Solving Next.js SyntaxError: Unexpected token ‘export’
  • Next.js Error: Found Page Without a React Component as Default Export – How to Fix
  • Fixing Next.js Error: Blank Page on Production Build
  • Fixing Next.js Error when Importing SVGs: A Step-by-Step Guide
  • Next.js Issue: useEffect Hook Running Twice in Client
  • Fixing ‘self’ is not defined error in Next.js when importing client-side libraries
  • How to Dockerize a Next.js App for Production
  • How to set up Next.js with Docker Composer and Nginx
  • Solving Next.js CORS Issues: A Comprehensive Guide
  • Fixing Next.js Hydration Mismatch Error in Simple Ways
  • Next.js Error: Cannot use import statement outside a module
  • Next.js: How to Access Files in the Public Folder
  • Fixing Next.js Import CSS Error: A Simple Guide
  • Fixing LocalStorage Not Defined Error in Next.js
  • Fixing Next.js Error: No HTTP Methods Exported