generator-angular icon indicating copy to clipboard operation
generator-angular copied to clipboard

Karma task isn't added to Gruntfile when --coffee is specified

Open jonniespratley opened this issue 11 years ago • 17 comments

To reproduce:

$ yo angular --coffee
$ grunt test
Warning: Task "karma" not found. Use --force to continue.

Aborted due to warnings.


Execution Time (2014-07-23 20:35:46 UTC)
loading tasks  6ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 86%
Total 7ms

jonniespratley avatar Jul 23 '14 20:07 jonniespratley

And so, I installed karma manually

$ npm install grunt-karma --save-dev

sanketsahu avatar Jul 25 '14 15:07 sanketsahu

Yeah this is probably a bug, but more likely a bug in generator-karma since if coffee is specified it won't automatically insert a config block into a Gruntfile.js file.

eddiemonge avatar Jul 31 '14 16:07 eddiemonge

Solution is probably to spit out a note at the end of the process saying to add the config block yourself.

@sanketsahusoft that doesn't solve this issue.

eddiemonge avatar Jul 31 '14 16:07 eddiemonge

This also occurred for me, but even without using --coffee. I was using version 0.9.5 of the generator without any command-line arguments, and without Sass and with Bootstrap.

cjerdonek avatar Aug 10 '14 18:08 cjerdonek

@cjerdonek is that still happening without --coffee? It shouldn't be.

eddiemonge avatar Sep 12 '14 21:09 eddiemonge

@eddiemonge Yep, I tried it again, and this time with generator-angular 0.9.8. Let me know if there's any additional info you'd like to know.

cjerdonek avatar Sep 12 '14 22:09 cjerdonek

By the way, I seemed to have a whole host of problems on the bower install & npm install stage of running the generator (it's saying I need to run the commands as root/Administrator which doesn't seem right). So I just inspected package.json manually.

cjerdonek avatar Sep 12 '14 22:09 cjerdonek

you probably setup npm to use a place you dont have permissions, or the folder you are generating in doesnt

eddiemonge avatar Sep 12 '14 22:09 eddiemonge

It looks like the .npm folder of my home directory doesn't have the proper permissions. But I don't recall changing anything from what npm does automatically. Anyway, I don't want to distract from the current issue.

cjerdonek avatar Sep 12 '14 22:09 cjerdonek

do you ever do sudo npm install?`

eddiemonge avatar Sep 12 '14 22:09 eddiemonge

Only when installing something globally with the -g flag.

cjerdonek avatar Sep 12 '14 23:09 cjerdonek

You shouldn't need to do that either. You should set your npm prefix to a place you have write access to

eddiemonge avatar Sep 12 '14 23:09 eddiemonge

Okay, thanks. Really good to know. I've gotten conflicting impressions of that over the time I've been learning about npm, e.g. https://github.com/npm/npm#more-details and https://github.com/npm/npm/issues/3139

I'll play around with things to avoid needing sudo.

cjerdonek avatar Sep 12 '14 23:09 cjerdonek

:+1: same issue here with v0.10.0 and no --coffee flag.

to reproduce: new $ yo angular myprojproject with all the default options and then imediately run $ grunt test gives a Warning: Task "karma" not found. Use --force to continue.

do you ever do sudo npm install?`

nope

manually adding the grunt-karma and karma packages to devdependencies in package.json (like in this patch) and then running again npm install solved the issue for me.

batista avatar Nov 12 '14 15:11 batista

@batista Your issue isnt the same one as here since without --coffee the tasks arent added. You probably had npm issues somewhere in the generation.

eddiemonge avatar Nov 12 '14 18:11 eddiemonge

I was able to fix it after reinstalling grunt-karma, karma, and karma-jasmine

krishpop avatar Jan 27 '15 20:01 krishpop

:+1:

toymachiner62 avatar Mar 30 '15 00:03 toymachiner62