使用yo angular创建项目时,项目目录没有生成karma.conf.js这个东西,提示You don’t seem to have a generator with the name “karma:app” installed
,是yeoman缺少这个生成器吗,这个生成器的名字是什么?
npm install -g generator-karma
声明:本文主要是解决通过yeoman创建的angular项目后在grunt serve 时发生的常见问题(Mac系统下进行,创建yeoman的安装及项目创建请参考:http://yeoman.io/)。
1.出现 >>> Fatal error: Unable to find local grunt.
解决方法:$ npm install grunt --save-dev
2.出现>>> Error: Cannot find module 'load-grunt-tasks'
解决方法:$ npm install --save-dev load-grunt-tasks
3.出现 >> Error: Cannot find module 'imagemin-gifsicle'>> Local Npm module "grunt-contrib-watch" not found. Is it installed?>> Local Npm module "grunt-wiredep" not found. Is it installed?
(以上对应的一个或多个或其中的组合,按上面的warning顺序解决)
解决方法:
$ npm install grunt-contrib-imagemin --save-dev
$ npm install --save-dev grunt-contrib-watch
$ npm install --save-dev grunt-wiredep
4.出现 >> Warning: Error: Cannot find where you keep your Bower packages. Use --force to continue.
解决方法:
$ npm install --save-dev grunt-wiredep $ bower install jquery --save(相比下面stackoverflow上的解决办法,我没有使用最后一个命令也ok了)
stackOverflow上的解决方法:
$ npm install --save-dev grunt-wiredep
$ bower install jquery --save$ grunt wiredep
补充:$ npm init (会引导你创建一个package.json文件,包括名称、版本、作者这些信息等)
npm i -g -d yeoman-generator