ANGULARJS Learning---ubuntu12.04 common problems in the installation configuration of Karma

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.