skip to Main Content

I created the next app using the command npx create-next-app@latest myapp
But then when I run the comman npm run dev the development server is not starting. It is struck here
enter image description here

I am pretty sure that I am inside my working directory when i run the command npm run dev

Also this is my package.json file

{
"name": "myapp",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"autoprefixer": "10.4.15",
"eslint": "8.48.0",
"eslint-config-next": "13.4.19",
"next": "13.4.19",
"postcss": "8.4.28",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.3"
}
}

3

Answers


  1. Next development server is already started. You just have to open http://localhost:3000/ in your browser.

    Login or Signup to reply.
  2. It is already running on port 3000 localhost check the 5th line of the image you posted

    Login or Signup to reply.
  3. Your server is started just open your browser and navigate to : http://localhost:3000/

    enter image description here

    if you want that your project open the browser directly after running the server just add the following open script to package.json (I tested in Windows 10 & 11):

      "scripts": {
        "build": "next build",
        "start": "next start",
        "lint": "next lint",
        "dev": "npm run open-browser && next dev",
        "open-browser": "start http://localhost:3000"
      },
    

    or for windows, linux and also WSL:

      "scripts": {
        "build": "next build",
        "start": "next start",
        "lint": "next lint",
        "dev": "(open http://localhost:3000 || cmd.exe /c start http://localhost:3000) && next dev"
      },
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search