How to install Next.js?

faisaljebali profile image Faiçal Jebali ・2 min read

How to install Next.js?

I wrote this tutorial to help you quickly learn Next.js and how to install with cli.

It's ideal for you if you have zero to little knowledge of Next.js, you have used React in the past, and you are looking forward diving more into the React ecosystem, in particular server-side rendering.
I find Next.js an awesome tool to create Web Applications, and at the end of this post I hope you'll be as excited about it as I am. And I hope it will help you learn Next.js!

How to install Next.js?
To install Next.js, you need to have Node.js installed.

Make sure that you have the latest version of Node. Check with running node -v in your terminal, and compare it to the latest LTS version listed on https://nodejs.org/.

After you install Node.js, you will have the npm command available into your command line.

Using create-next-app
If you're familiar with create-react-app, create-next-app is the same thing - except it creates a Next app instead of a React app, as the name implies.

I assume you have already installed Node.js, which, from version 5.2 (2+ years ago at the time of writing), comes with the npx command bundled. This handy tool lets us download and execute a JavaScript command, and we'll use it like this:

npx create-next-app

The command asks the application name (and creates a new folder for you with that name), then downloads all the packages it needs (react, react-dom, next)

and you can immediately run the sample app by running npm run dev

And here's the result on http://localhost:3000:

Posted on by:

faisaljebali profile

Faiçal Jebali


FULLSTACK DEVELOPER Frontend: Angular 4+, React js, Vue js Backend: Symfony, Laravel, (NodeJs, Express, Mongodb),


markdown guide