Yeoman, Angular Generator and Karma Test not working

I am trying to use Yeoman with an angular generator to start a new application.

I ran this command (as per the docs) to launch a new application:

yo angular my-app-name

All dependencies are loaded, and if I run

grunt serve

my base application appears in the browser and everything works fine. The problem starts when I try to run:

grunt test

I get an error message: Warning: Task "karma" not found. Use --force to continue.

So, I added the following line:

"grunt-karma": "*",
"generator-karma": "*"

in my packeage.jsonfile, delete the folder node_modulesand run `npm install. I solved the problem, but now I get the error message:

loading "grunt-karma.js" tasks...ERROR
>> Error: Cannot find module 'socket.io-client'
Warning: Task "karma" not found. Use --force to continue.

Aborted due to warnings.

I tried to work a little with Google, but I can not find anything. I am running MacOSX 10.8.5 and node v0.10.0. Any suggestion?

Thank you in advance

+4
3

angular -. ?

, , . :

npm install grunt-karma karma-ng-html2js-preprocessor karma-ng-scenario --save-dev 

, , , package.json :

"karma-ng-scenario": "~0.1.0",
"grunt-karma": "~0.6.2",
"karma-script-launcher": "~0.1.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.2",
"karma-html2js-preprocessor": "~0.1.0",
"karma-jasmine": "~0.1.5",
"requirejs": "~2.1.9",
"karma-requirejs": "~0.2.1",
"karma-coffee-preprocessor": "~0.1.1",
"karma-phantomjs-launcher": "~0.1.1",
"karma": "~0.10.8",
"karma-ng-html2js-preprocessor": "~0.1.0"

npm install .

+7

yoman ( 2014) js , karma.conf.is bower_components, . karma.conf.is bower_components node_modules.

0

The cause of the problem occurs in an earlier phase. The solution is not to change the kama configuration file, but to execute the command: git config --global url. "https: //" .insteadOf git: //

0
source

Source: https://habr.com/ru/post/1527477/


All Articles