Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build a Simple Dynamic Site with Node.js Creating a Simple Server in Node.js Creating a Simple Server

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Killing a Process with Node on Windows

Hi all,

I'm having issues killing processes using the same method described in the video. I've tried opening a second instance of Node in the command prompted while a server is running but it doesn't recognise either the kill or of the ps command

'ps' is not recognized as an internal or external command, operable program or batch file.

Is it vital that I need to be able to do this?

I can very easily kill all open processes by simply breaking out of the REPL with Ctrl + C.

Thanks. :)

3 Answers

Seth Kroger
Seth Kroger
56,413 Points

You can also kill it from the Task Manager for for that matter. The important thing is that you're able to kill the old node process attached to the port. Andrew is showing a way to do it if you don't have access to it's console that works on Workspaces (as well as Linux/Mac)

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

So the ps and kill commands are workspace specific? Or specific to the framework that's the workspaces console is built on. :)

Seth Kroger
Seth Kroger
56,413 Points

They're Unix commands, so yes, they are platform specific. :)

ryanjones6
ryanjones6
13,797 Points

If you want to work in a linux simulated environment on Windows download Git for windows. This will install: Git Bash, Git CMD, and Git GUI. The Git Bash allows for linux commands. -- Also an alternative to killing the server is to type: CTRL + C. This will stop the server: you can then just run the command: node app.js and restart the server.

Git Download: https://git-scm.com/downloads

I killed the process in the windows powershell like so: (might work in command line too)

1) type 'ps' to show list of processes 2) find the process named 'node', and note the Id 3) type 'Stop-process <Id>'