使用yo angular建立项目时,项目目录没有生成karma.conf.js这个东西,提示You don’t seem to have a generator with the name “karma:app” installed
,是yeoman缺乏这个生成器吗,这个生成器的名字是什么?jquery
npm install -g generator-karmanpm
声明:本文主要是解决经过yeoman建立的angular项目后在grunt serve 时发生的常见问题(Mac系统下进行,建立yeoman的安装及项目建立请参考:http://yeoman.io/)。 json
1.出现 >>> Fatal error: Unable to find local grunt.app
解决方法:$ npm install grunt --save-devgrunt
2.出现>>> Error: Cannot find module 'load-grunt-tasks'code
解决方法:$ npm install --save-dev load-grunt-tasksbower
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?generator
(以上对应的一个或多个或其中的组合,按上面的warning顺序解决)it
解决方法:io
$ 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