The Problem

I was setting up continuous integration using CircleCI with karma test for Angular on Heroku. The test was working on local host, but karam was not found on CircleCI:

Uh-oh, some tests have failed!
Failing command: npm test
Exit code: 1
Output:
> karma start karma.conf.js

sh: 1: karma: not found
npm ERR! Test failed. See above for more details.
((npm :test)) returned exit code 1

My Solution

Create or edit your circle.yml config file, add dependencies by using npm to install karma-cli globally, use bower to install angular as well as shown below:

dependencies:
pre:
- npm install -g karma-cli bower
- bower install
cache_directories:
- ~/nvm

Originally published at victorleungtw.com on December 22, 2014.