Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running karma after installation results in 'karma' is not recognized as an internal or external command

I'm trying to run karma as part as an angular-seed project, after installing karma using

npm install -g karma 

I get:

'karma' is not recognized as an internal or external command, operable program or batch file. 

when i'm trying to run test.bat from angular-client\scripts, the content of this file is:

set BASE_DIR=%~dp0

karma start "%BASE_DIR%..\config\karma.conf.js" %*

I also tried to navigate to "\AppData\Roaming\npm\node_modules\karma\bin" and saw karma file, when I'm trying to run it I get again:

'karma' is not recognized as an internal or external command, operable program or batch file.

Any suggestions? If not please suggest how to use jasmine without karma.

Thanks.

like image 824
Liad Livnat Avatar asked Dec 27 '13 12:12

Liad Livnat


People also ask

How do you fix node is not recognized as an internal or external command?

Click on the edit system environment variables, a window will open where you have to click on Environment Variables. The Environment Variables window will open where you have to select or double click on the variable Path. Now paste the complete path where Node. js was installed.

Which of the following command is used to grab the Karma CLI?

Typing ./node_modules/karma/bin/karma start sucks and so you might find it useful to install karma-cli globally. You will need to do this if you want to run Karma on Windows from the command line. Then, you can run Karma simply by karma from anywhere and it will always run the local version.


2 Answers

The command line interface is in a separate package.

To install this use:

npm install -g karma-cli

like image 197
MrCheese Avatar answered Sep 18 '22 13:09

MrCheese


karma-cli

It is recommended to install karma with its Command-Line-Interface (karma-cli) which will take care of fetching the appropriate karma. You can also install a different local version specific to each project you're working on and karma-cli will pick the appropriate one.

From the karma installation page:

Typing ./node_modules/karma/bin/karma start sucks so you might find it useful to install karma-cli globally:

npm install -g karma-cli 

Now, check that karma was installed by typing:

which karma  //echo something like: /usr/local/bin/karma 

and check that karma server is working (ctr+c to quit):

karma start  

You can also check that karma was installed by going to this directory:

cd /usr/local/lib/node_modules/karma 

Good luck!

like image 43
Lior Elrom Avatar answered Sep 18 '22 13:09

Lior Elrom