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 npm Basics Managing Packages with NPM Installing Packages

David Kayser
David Kayser
12,009 Points

zsh: command not found: http-server

I'm getting this error - not sure what to do.

2 Answers

David Kayser
David Kayser
12,009 Points

So took me a while to sort this all out but if you're using a Mac I suspect you'll have similar issues. One big problem is that ZSH is now standard on Mac over BASH, and it seems Node, NPM, and Homebrew will all give you issues if using ZSH.

You can switch the terminal to using BASH with this command: chsh -s /bin/bash You'll have to enter your password and restart Terminal but it should work.

If you've already tried installing Node you'll probably have a bunch of errors so I followed this tutorial to remove it: Remove Node

After you've done that follow Homebrew's instructions for installation, not the instructions here: Install Homebrew

Instructions are to use this code to install but take a look at their site for more clarification:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Anyway, hope this helps anyone with similar issues on a Mac.

ChienTsun Chan
ChienTsun Chan
7,042 Points

you can try to use "npx http-server ..." after installing the package.