使用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