Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 90,845 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,406 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 90,845 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,406 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>'