Search code examples
node.jsbashnext.jsterminal

Kill a NextJs process in terminal


I used to be able to kill a NextJs process with killall -9 node. Since the most recent nextJS update this no longer works. I can see this with lsof -i :3000.

How can I kill my NextJS process?


Solution

  • You can now kill a NextJS process with:

    killall -9 next-server
    

    ———

    UPDATE JUNE 24 2024

    New versions of NextJs specify the version number in the process. This requires changes to the command:

    killall -9 'next-server (v14.2.3)'
    

    Because this will probably continue to change, I recommend using a wildcard pattern like:

    pkill -9 ^next-server
    # or
    kill -9 $(pgrep -f '^next-server')