Heads Up! You're viewing the docs for v0.10, an old version of Karma. v6.4 is the newest.

Installation

Karma runs on Node.js and is available via NPM.

Requirements #

  1. Node.js

    There are installers for both Mac and Windows. On Linux, we recommend using NVM.

  2. Node Package Manager (NPM)

    NPM is a package manager for Node.js which is used to install Karma. This should automatically be installed when Node.js is installed, but if not then please install it afterwards.

Global "System-Wide" Installation #

This is the recommended approach to installing and making use of Karma. It will install Karma into your global node_modules directory and create a symlink in your system path, so that you can run the karma command from any directory. This means that the karma command (which is the central command that Karma uses to run tests) can be executed anywhere via the command line.

The following command will install Karma globally:

$ npm install -g karma

Please note, that the karma command will always look for a locally installed instance of Karma first and before resorting to a global install and, if present, then the local version will be utilized. This allows you to use different version of Karma per project.

Local Installation #

A local installation will install Karma into your current directory's node_modules.

$ npm install karma --save-dev

The karma command can now be also executed directly from the node_modules directory:

$ ./node_modules/.bin/karma