Next.js Discord

Discord Forum

Stopping the dev server

Answered
Luan posted this in #help-forum
Open in Discord
Hi guys

I've upgraded to the new release nextjs 13.5. Now when I stop the dev server by pressing CTRL-C I'm getting the following error

X uncaughtException: TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('SIGINT')
at process.set [as exitCode] (node:internal/bootstrap/node:124:9)
at process.exit (node:internal/process/per_thread:188:24)
at process.cleanup (/home/luan/projects/website/node_modules/next/dist/server/lib/start-server.js:208:29)
at process.emit (node:events:523:35)
at Signal.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'ERR_INVALID_ARG_TYPE'
}

The next-worker still remains running in the background processes

Have I been doing something wrong the whole time when stopping the dev server, or is that actually a bug?
Answered by joulev
upgrade to canary
View full answer

15 Replies

this is killing my ram, i have to restart wsl to clear that mess up which is kind of annoying
#!/bin/bash

# Get a list of process IDs (PIDs) for processes with the name "next-router-worker"
pids=$(pgrep next-router-worker)

# Check if there are any matching processes
if [ -n "$pids" ]; then
  echo "Killing the following next-router-worker processes:"
  echo "$pids"
  
  # Send the SIGTERM signal to each process to gracefully terminate them
  for pid in $pids; do
    kill -15 "$pid"
  done

  # Wait for a short moment to allow processes to terminate gracefully
  sleep 2

  # Check if any processes are still running and forcefully terminate them if necessary
  for pid in $pids; do
    if ps -p "$pid" > /dev/null; then
      echo "Process $pid did not terminate gracefully, forcefully killing..."
      kill -9 "$pid"
    fi
  done
else
  echo "No next-router-worker processes found."
fi
@@ts-ignore you can write some bash shenanigans and kill them
shouldnt ctrl c just kill all of them£?
youre running 13.5 too?
Answer
the bug is fixed there
@Luan shouldnt ctrl c just kill all of them£?
yes but it was a bug
@@ts-ignore it does for me
it doesn't for you; the bug should be platform-agnostic
check your process list (iirc called task manager?)
you'll see a wild next-router-worker running even after you shut down the dev server
yep canary build looks like it fixed my issue
thanks @joulev