vercel / next.js

The React Framework
https://nextjs.org
MIT License
122.87k stars 26.27k forks source link

Dev server is not properly closing and giving an error when a port is taken. #63987

Closed Ragudos closed 3 months ago

Ragudos commented 3 months ago

Link to the code that reproduces this issue

I don't know how to reproduce since it's a port being taken.

To Reproduce

  1. Have the port your dev server's using be taken.
  2. Start server
  3. Notice it not failing and if you go to a page, nothing happens.

Note: works in both turbo and normal.

Current vs. Expected behavior

current: no errors, just stays like this:

▲ Next.js 14.1.4 (turbo)
   - Local:        http://localhost:3000
   - Environments: .env.development.local

 ✓ Ready in 2.2s

expected: An error to occur saying that the port is taken.

Provide environment information

Operating System:
platform: Windows 10
version: 21H1
os build: 19043.1826

Packages:
"dependencies": {
        "@auth/drizzle-adapter": "^0.8.2",
        "@hookform/resolvers": "^3.3.4",
        "@radix-ui/react-accordion": "^1.1.2",
        "@radix-ui/react-alert-dialog": "^1.0.5",
        "@radix-ui/react-aspect-ratio": "^1.0.3",
        "@radix-ui/react-avatar": "^1.0.4",
        "@radix-ui/react-checkbox": "^1.0.4",
        "@radix-ui/react-collapsible": "^1.0.3",
        "@radix-ui/react-dialog": "^1.0.5",
        "@radix-ui/react-dropdown-menu": "^2.0.6",
        "@radix-ui/react-label": "^2.0.2",
        "@radix-ui/react-navigation-menu": "^1.1.4",
        "@radix-ui/react-progress": "^1.0.3",
        "@radix-ui/react-scroll-area": "^1.0.5",
        "@radix-ui/react-select": "^2.0.0",
        "@radix-ui/react-separator": "^1.0.3",
        "@radix-ui/react-slot": "^1.0.2",
        "@radix-ui/react-switch": "^1.0.3",
        "@radix-ui/react-tabs": "^1.0.4",
        "@t3-oss/env-nextjs": "^0.9.2",
        "class-variance-authority": "^0.7.0",
        "clsx": "^2.1.0",
        "cmdk": "^1.0.0",
        "drizzle-orm": "^0.30.6",
        "embla-carousel-react": "^8.0.0",
        "lucide-react": "^0.364.0",
        "next": "14.1.4",
        "next-auth": "^5.0.0-beta.16",
        "next-themes": "^0.3.0",
        "nodemailer": "^6.9.13",
        "postgres": "^3.4.4",
        "react": "^18",
        "react-dom": "^18",
        "react-hook-form": "^7.51.2",
        "sonner": "^1.4.41",
        "tailwind-merge": "^2.2.2",
        "tailwindcss-animate": "^1.0.7",
        "zod": "^3.22.4"
    },
    "devDependencies": {
        "@playwright/test": "^1.42.1",
        "@types/node": "^20",
        "@types/react": "^18",
        "@types/react-dom": "^18",
        "autoprefixer": "^10.0.1",
        "drizzle-kit": "^0.20.14",
        "eslint": "^8",
        "eslint-config-next": "14.1.4",
        "postcss": "^8",
        "prettier": "^3.2.5",
        "tailwindcss": "^3.3.0",
        "typescript": "^5"
    }

Executables:
node: v20.10.0
npm: v10.5.0

NextJS Config:

const defaultSecurityHeaders = [
    {
        key: "X-XSS-Protection",
        value: "1; mode=block",
    },
    {
        key: "X-Frame-Options",
        value: "DENY",
    },
    {
        key: "X-Content-Type-Options",
        value: "nosniff",
    },
];

/** @type {import('next').NextConfig} */
const nextConfig = {
    logging: {
        fetches: {
            fullUrl: true,
        },
    },
    headers: async () => {
        return [
            {
                source: "/:path",
                headers: defaultSecurityHeaders,
            },
        ];
    },
};

export default nextConfig;

Which area(s) are affected? (Select all that apply)

App Router, Turbopack (--turbo)

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

I just killed the port and it worked. I'm hoping for a helpful error message for those who may take longer than I did to figure it out.

github-actions[bot] commented 3 months ago

We could not detect a valid reproduction link. Make sure to follow the bug report template carefully.

Why was this issue closed?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We need a link to a public GitHub repository (template for App Router, template for Pages Router), but you can also use these templates: CodeSandbox: App Router or CodeSandbox: Pages Router.

The bug template that you filled out has a section called "Link to the code that reproduces this issue", which is where you should provide the link to the reproduction.

What should I do?

Depending on the reason the issue was closed, you can do the following:

In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.

My repository is private and cannot make it public

In most cases, a private repo will not be a sufficient minimal reproduction, as this codebase might contain a lot of unrelated parts that would make our investigation take longer. Please do not make it public. Instead, create a new repository using the templates above, adding the relevant code to reproduce the issue. Common things to look out for:

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps by opening a new issue.

I think my reproduction is good enough, why aren't you looking into it quickly?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources