我用Yo angular-genertor构建了一个Angular应用程序,
我使用Grunt Build fine构建应用程序,然后我添加了Bootstrap 3和npm install grunt-bower-install
我将这些行添加到Grunt文件中
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
//ADDED THIS LINE
grunt.loadNpmTasks('grunt-bower-install');
grunt.initConfig({
yeoman: {
// configurable paths
app: require('./bower.json').appPath || 'app',
dist: 'dist'
},
//ADDED THESE LINES
'bower-install': {
target: {
src: [
'app/index.html'
],
}
},不过,我已经删除了这些行!
现在Grunt Build抛出了这个错误
Running "bowerInstall:app" (bowerInstall) task
Warning: Cannot read property 'main' of undefined Use --force to continue.
Aborted due to warnings.我确实知道该怎么做,甚至知道从哪里开始?
发布于 2014-05-26 03:05:25
在我的yeoman生成的项目中,此任务如下所示:
'bower-install': {
app: {
html: '<%= yeoman.app %>/index.html',
ignorePath: '<%= yeoman.app %>/'
}
},在较新的版本中,使用src而不是html
'bowerInstall': {
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: '<%= yeoman.app %>/'
}
},也许你可以根据你的情况改编一下。尽管我认为它不需要任何改变就可以工作。
但你有几乎相同的,所以也许问题在另一个地方。
发布于 2014-05-26 03:06:52
我找到了答案,
我只需要运行Bower Install,
https://stackoverflow.com/questions/23858858
复制相似问题