First, make sure that Node.js is installed on your computer.
Install Karma using npm:
The recommended approach is to install Karma (and all the plugins your project needs) locally in the project's directory.
npm install karma
Install karma-cli globally:
Use WebStorm’ built-in npm and search for karma-cli, add -g option before hitting Install for global installation.
Or use built-in Terminal to install karma-cli with:
npm install -g karma-cli
To run new tests with Karma, you need to have a Karma configuration file (learn more about it).