Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The '@angular-devkit/build-angular/plugins/karma' karma plugin is meant to be used from within Angular CLI and will not work correctly outside of it

Tags:

angular

When i am trying to config and run the .sh file in local environment, getting this error:

Error: The '@angular-devkit/build-angular/plugins/karma' karma plugin is meant to be used from within Angular CLI and will not work correctly outside of it.

I tried to use CLI but its not worked for me.

Please help me to resolve this issue.

The following file I have created to execute karma.

run_unit_test.sh

./node_modules/karma/bin/karma start src/karma.conf.js

like image 220
Vijayakumar M Avatar asked Nov 06 '22 22:11

Vijayakumar M


2 Answers

I got this error in my WebStorm and I noticed that in

Run/Debug ConfigurationsKarma package input, was wrong package path - path_to_project/node_modules/karma

Error gone when I set it to: path_to_project/node_modules/@angular/cli

I know that I'm late with this answer and that this doesn't quite fit your situation. But I know that people with a similar problem often get here and I will leave this post for them.

like image 83
Denis T. Avatar answered Nov 15 '22 05:11

Denis T.


For me wrapping this call into ng fixed it:

ng test --karma-config src/karma.conf.js

It seems this was a break sometime around angular 6 release.

In my case specifically I actually used

ng test --karma-config karma.conf.js --browsers Chrome_with_debugging

like image 31
P.Brian.Mackey Avatar answered Nov 15 '22 07:11

P.Brian.Mackey