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 trialJan Maas
2,282 PointsWhen following along the JavaScript Unit Testing I cannot run any "mocha" commands
I am following the tutorial on JavaScript Unit Testing along on my own mac. The command npm-test
runs my test suites fine. But as soon as I try any command with "mocha", like: mocha -- watch ./test/game_test.js .game_logic/game_instance.js
I get an error stating: mocha: command not found
.
I believe it has something to do with my mocha install locally, but really I am not experienced enough to understand what is wrong. I can't find much help that I can understand on google on the matter... Any help would be appreciated :) thanks J
3 Answers
Rich Donnellan
Treehouse Moderator 27,708 PointsDid you run this global install or read the docs?
npm install -g mocha
Usually when a program: command not found
error happens, the program isn't installed.
Rich Donnellan
Treehouse Moderator 27,708 PointsUpdate: If you're running npm version >=5, you can now run npx mocha
without having to install anything globally.
You can learn more about npx by reading the docs.
Jan Maas
2,282 PointsThank you so much for your reply :) It was indeed an install problem, I had to fix my permissions in order to get mocha to install propperly: https://docs.npmjs.com/getting-started/fixing-npm-permissions