generator-angular
generator-angular copied to clipboard
Karma task isn't added to Gruntfile when --coffee is specified
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
And so, I installed karma manually
$ npm install grunt-karma --save-dev
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.
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.
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 is that still happening without --coffee? It shouldn't be.
@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.
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.
you probably setup npm to use a place you dont have permissions, or the folder you are generating in doesnt
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.
do you ever do sudo npm install?`
Only when installing something globally with the -g flag.
You shouldn't need to do that either. You should set your npm prefix to a place you have write access to
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.
:+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 Your issue isnt the same one as here since without --coffee the tasks arent added. You probably had npm issues somewhere in the generation.
I was able to fix it after reinstalling grunt-karma, karma, and karma-jasmine
:+1: