There are a number of issues with Karma Startup:
1. Installation Karma Prerequisites
Install Karma First to install NODEJS,NPM before you can install the KARMA.NODEJS,NPM installation process can refer to the article: ANGULARJS Learning---ANGULARJS environment construction, Ubuntu 12.04 installation of Nodejs, NPM and Karma
2. Installing Karma steps
Karma Official Guide Tutorial: http://karma-runner.github.io/0.12/intro/installation.html
1). First execute the following command:
Install -G karma
2). Install KARMA-CLI
Install -G karma-cli
3) To install the plugin:
Install karma-jasmine karma-chrome-launcher--save-dev
3.karma startup settings and error handling
Start karma:
Karma Start
The following error is reported:
[Email protected]:~/develop/angular-phonecat$ Karma Startmodule.js:340throw err; ^Error:cannotFindModule'Zeparser'At function.module._resolvefilename (module.js:338: the) at Function.module._load (module.js:280: -) at Module.require (module.js:364: -) at require (module.js:380: -) at Object.<anonymous> (/home/amosli/develop/angular-phonecat/node_modules/karma/node_modules/socket.io/node_modules /socket.io-client/node_modules/active-x-obfuscator/index.js:1: +) at Module._compile (module.js:456: -) at Object.module._extensions. JS (module.js:474:Ten) at Module.load (module.js:356: +) at Function.module._load (module.js:312: A) at Module.require (module.js:364: -)
Workaround:
sudo Install Zeparser
The reason is that there is no installation of Zeparser, install it.
Then reconfigure the karma with the following configuration steps:
This will generate karam.conf.js after Karma init.
We need to modify this: files and exclude variables
Module.exports =function(config) {config.set ({basepath:"', Frameworks: ['Jasmine'], files: [ '*.js'], exclude: ['karma.conf.js' ], reporters: ['Progress'], Port:9876, colors:true, Loglevel:config. Log_info, Autowatch:true, browsers: ['Chrome'], Capturetimeout:60000, Singlerun:false });};
It is then better to move the karma.conf.js to/usr/local/lib/node_modules/karma/so that the Karam.conf.js file is found directly in the root directory at startup.
Re-enter Karma start
[Email protected]:~$ karma startinfo [karma]: Karma V0. 12.14 Server started at http://localhost:9876/34.0. 1847 ID manual-8888
Configuration Reference http://blog.fens.me/nodejs-karma-jasmine/