咕噜服务:并发:服务器中止由于警告 [英] grunt serve: concurrent:server aborts due to warnings

查看:152
本文介绍了咕噜服务:并发:服务器中止由于警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我突然停止项目与咕噜工作。不幸的是,我没有犯我一会儿到Git的变化,所以我不能告诉什么不同。

当我运行咕噜服务器--verbose ,我得到下面的输出(上面的一切 ... 通行证与确定

  ...
运行wiredep任务运行wiredep:应用程序(wiredep)任务
验证属性wiredep.app存在于配置... OK
文件:应用程序/ index.html的
验证wiredep.app.src存在于config属性... OK运行wiredep:上海社会科学院(wiredep)任务
验证属性wiredep.sass存在于配置... OK
文件:应用程序/风格/ analyzer.scss,应用程序/风格/ colors.scss,应用程序/风格/ login.scss,应用程序/风格/ main.scss,应用程序/风格/ shared.scss,应用程序/风格/ styles.scss,应用程序/风格/ tagsinput.scss
验证wiredep.sass.src存在于config属性... OK运行并发:服务器(并发)任务
验证属性concurrent.server存在于配置... OK
文件:[无SRC] - >服务器
选项​​:上限= 2
    警告:使用--force继续。        由于警告中止。
执行时间(2014年6月24日8点34分05秒,UTC)
加载任务8ms的0%
服务2ms的0%
清洁:服务器10ms的0%
wiredep:应用242ms▇▇▇▇▇▇▇4%
wiredep:上海社会科学院17MS 0%
并发:服务器5.3s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 95%
总5.6s

服务器:

所以,试图执行任务并发时的呼噜声中止。这里面的任务,在罗盘:服务器任务执行(请参阅 Gruntfile.js 下面)。因此,它必须有一些待办事项带指南针,但我不知道这行文件:[无SRC] - >服务器可能的问题给予更多的提示。

这是我的 Gruntfile.js

  //使用发电机组角0.9.0-1在2014年6月16日产生
使用严格的;//#通配符
//由于性能原因我们只匹配向下一个级别:
//'测试/规格/ {* /} *。JS
//如果你想递归匹配所有子文件夹使用:
//'测试/规格/ ** / *。JSmodule.exports =功能(呼噜声){  //加载咕噜自动任务
  需要('负载咕噜任务)(呼噜声);  //长时间的任务怎么拿。可以帮助在优化构建时间
  需要('时间咕噜')(呼噜声);  为应用程序//配置路径
  VAR的AppConfig = {
    应用:要求('./ bower.json')|| APPPATH。 应用程序,
    距:'DIST'
  };  //定义配置的所有任务
  grunt.initConfig({    //项目设置
    自耕农:AppConfig中,    //手表文件的变化,并根据修改过的文件运行任务
    手表:{
      亭子:{
        文件:['bower.json'],
        任务:['wiredep']
      },
      JS:{
        文件:['<%= yeoman.app%GT; /脚本/ {* /} * JS'],
        任务: [],
        选项​​:{
          livereload:'<%= connect.options.livereload%GT;'
        }
      },
      jsTest:{
        文件:['。测试/规格/ {* /} * JS'],
        任务:['更新:jshint:测试','新:jshint:所有','因果报应']
      },
      指南针:{
        文件:['<%= yeoman.app%GT; /风格/ {* /} * {SCSS,上海社会科学院}'],
        任务:['指南针:服务器','汽车prefixer'],
        选项​​:{
            产卵:假的,
        }
      },
      gruntfile:{
        文件:['Gruntfile.js']
      },
      livereload:{
        选项​​:{
          livereload:'<%= connect.options.livereload%GT;'
        },
        文件:
          '<%= yeoman.app%GT; / {* /} * HTML。,
          '<%= yeoman.app%方式> /脚本/指令/ ** / * HTML,
          .TMP /风格/ {* /} *。CSS,
          '<%= yeoman.app%方式> /图像/ {* /} * {PNG,JPG,JPEG,GIF,WEBP,SVG}
        ]
      }
    },    //实际咕噜服务器设置
    连接:{
      选项​​:{
        端口:9000,
        //更改为0.0.0.0从外部访问该服务器。
        主机名:'localhost'的,
        livereload:35729
      },
      livereload:{
        选项​​:{
          打开:假的,
          中间件:功能(连接){
            返回[
              connect.static('。tmp目录),
              连接()。使用(
                '/ bower_components',
                connect.static('./ bower_components')
              )
              connect.static(appConfig.app)
            ];
          }
        }
      },
      测试:{
        选项​​:{
          端口:9001,
          中间件:功能(连接){
            返回[
              connect.static('。tmp目录),
              connect.static(测试),
              连接()。使用(
                '/ bower_components',
                connect.static('./ bower_components')
              )
              connect.static(appConfig.app)
            ];
          }
        }
      },
      距:{
        选项​​:{
          打开:假的,
          基地:'<%= yeoman.dist%GT;'
        }
      }
    },    //确保code风格都达到标准,并没有出现明显的失误
    jshint:{
      选项​​:{
        jshintrc:.jshintrc',
        记者:需要('jshint-时尚')
      },
      所有:{
        SRC:
          Gruntfile.js',
          '&所述;%= yeoman.app%方式> /脚本/ {* /} * JS'
        ]
      },
      测试:{
        选项​​:{
          jshintrc:测试/ .jshintrc
        },
        SRC:['测试/规格/ {* /} * JS。']
      }
    },    //清空文件夹重新开始
    清洁:{
      距:{
        文件:[{
          点:真实,
          SRC:
            .TMP,
            '&所述;%= yeoman.dist%GT / {* /} *',
            '!&下;%= yeoman.dist%方式> / GIT中*'
          ]
        }]
      },
      服务器:'的.tmp
    },    //添加厂商prefixed风格
    汽车prefixer:{
      选项​​:{
        浏览器:['最后1版']
      },
      距:{
        文件:[{
          拓展:真实,
          CWD:.TMP /风格/',
          SRC:'{* /} * CSS,
          DEST:.TMP /风格/
        }]
      }
    },    //自动注入鲍尔组件到应用程序
    wiredep:{
      应用:{
        的src:['&下;%= yeoman.app%GT; /index.html'],
        ignorePath:新的RegExp(^<%= yeoman.app%GT; / | ../')
      },
      上海社会科学院:{
        SRC:['<%= yeoman.app%GT; /风格/ {* /} * {SCSS,上海社会科学院}'],
        ignorePath:/(\\.\\.\\/){1,2}bower_components\\//
      }
    },    //编译萨斯到CSS,如果要求生成必要的文件
    指南针:{
      选项​​:{
        sassDir:'<%= yeoman.app%GT; /风格',
        cssDir:.TMP /风格',
        generatedImagesDir:.TMP /图像/生成,
        imagesDir:'<%= yeoman.app%GT; /图像,
        javascriptsDir:'<%= yeoman.app%GT; /脚本,
        fontsDir:'<%= yeoman.app%GT; /风格/字体,
        importPath:./bower_components',
        httpImagesPath:/图像,
        httpGeneratedImagesPath:'/图像/生成,
        httpFontsPath:'/风格/字体,
        relativeAssets:假的,
        assetCacheBuster:假的,
        原料:'萨斯::脚本::数precision = 10 \\ N'
      },
      距:{
        选项​​:{
          generatedImagesDir:'<%= yeoman.dist%GT; /图像/生成
        }
      },
      服务器:{
        选项​​:{
          debuginfo软:真
        }
      }
    },    //重命名为浏览器缓存文件的目的
    filerev:{
      距:{
        SRC:
          '<%= yeoman.dist%GT; /脚本/ {* /} * JS。,
          '<%= yeoman.dist%GT; /风格/ {* /} * CSS。​​,
          '<%= yeoman.dist%方式> /图像/ {* /} * {PNG,JPG,JPEG,GIF,WEBP,SVG}
          '<%= yeoman.dist%GT; /风格/字体/ *
        ]
      }
    },    //读取HTML的usemin块启用智能的自动生成
    // CONCAT,缩小和修订文件。在内存中创建的配置,从而
    //其他任务可以对它们进行操作
    usemin prepare:{
      HTML:'<%= yeoman.app%GT; /index.html',
      选项​​:{
        DEST:'<%= yeoman.dist%GT;,
        流: {
          HTML:{
            脚步: {
              JS:['CONCAT','uglifyjs'],
              CSS:['cssmin']
            },
            岗位:{}
          }
        }
      }
    },    //执行基于filerev和usemin prepare配置重写
    usemin:{
      HTML:['<%= yeoman.dist%GT; / {* /} * HTML'],
      CSS:['<%= yeoman.dist%GT; /风格/ {* /} * CSS'],
      选项​​:{
        assetsDirs:['&下;%= yeoman.dist%GT;','&下;%= yeoman.dist%GT /图像']
      }
    },    //下面* -min任务将产生dist文件夹minified的文件
    //默认情况下,你的`index.html`的<! - Usemin块 - >会照顾
    //缩小。这些选项旁边是pre-配置,如果你不希望
    //使用Usemin块。
    // cssmin:{
    // DIST:{
    //文件:{
    //'<%= yeoman.dist%GT; /styles/main.css':[
    //'的.tmp /风格/ {* /} *。CSS
    //]
    //}
    //}
    //},
    //丑化:{
    // DIST:{
    //文件:{
    //'<%= yeoman.dist%GT; /scripts/scripts.js':[
    //'<%= yeoman.dist%GT; /scripts/scripts.js
    //]
    //}
    //}
    //},
    // CONCAT:{
    // DIST:{}
    //},    imagemin:{
      距:{
        文件:[{
          拓展:真实,
          CWD:'<%= yeoman.app%GT; /图像,
          SRC:'{* /} * {PNG,JPG,JPEG,GIF}
          DEST:'<%= yeoman.dist%GT; /图像
        }]
      }
    },    svgmin:{
      距:{
        文件:[{
          拓展:真实,
          CWD:'<%= yeoman.app%GT; /图像,
          SRC:'{* /} * SVG',
          DEST:'<%= yeoman.dist%GT; /图像
        }]
      }
    },    htmlmin:{
      距:{
        选项​​:{
          collapseWhitespace:真实,
          conservativeCollapse:真实,
          collapseBooleanAttributes:真实,
          removeCommentsFromCDATA:真实,
          removeOptionalTags:真
        },
        文件:[{
          拓展:真实,
          CWD:'<%= yeoman.dist%GT;,
          SRC:'意见/ {* /} * HTML''*。html的'],
          DEST:'<%= yeoman.dist%GT;'
        }]
      }
    },    // ngmin通过试图使code为安全自动缩小
    //使用角长格式依赖注入。它不工作的
    //之类的东西解决或注入所以这些必须手动完成。
    ngmin:{
      距:{
        文件:[{
          拓展:真实,
          CWD:.TMP / CONCAT /脚本,
          SRC:'* .js文件',
          DEST:.TMP / CONCAT /脚本
        }]
      }
    },    //取代谷歌CDN引用
    cdnify:{
      距:{
        HTML:['<%= yeoman.dist%GT; / * HTML。]
      }
    },    //剩余复制文件到地方其他任务可以使用
    复制:{
      距:{
        文件:[{
          拓展:真实,
          点:真实,
          CWD:'<%= yeoman.app%GT;,
          DEST:'<%= yeoman.dist%GT;,
          SRC:
            * {ICO等,PNG,TXT}
            '的.htaccess',
            *。html的',
            意见/ {* /} * HTML,
            图像/ {* /} * {} WEBP,
            字体/ *
          ]
        },{
          拓展:真实,
          CWD:.TMP /图像,
          DEST:'<%= yeoman.dist%GT; /图像,
          SRC:['生成/ *]
        },{
          拓展:真实,
          CWD:,'。'
          SRC:bower_components /引导-萨斯官方/供应商/资产/字体/引导/ *',
          DEST:'<%= yeoman.dist%GT;'
        }]
      },
      款式:{
        拓展:真实,
        CWD:'<%= yeoman.app%GT; /风格',
        DEST:.TMP /风格/',
        SRC:'{* /} * CSS
      }
    },    //并行运行某些任务,加快构建过程
    同时: {
      服务器:
        指南针:服务器
      ]
      测试:
        '罗盘'
      ]
      DIST:
        指南针:DIST',
        imagemin',
        svgmin
      ]
    },    //测试设置
    因果报应:{
      单位:{
        CONFIGFILE:测试/ karma.conf.js',
        singleRun:假的
      }
    }
  });
  grunt.loadNpmTasks('咕噜-SASS');  grunt.registerTask('服务','编译然后启动一个连接Web服务器'功能(目标){
    如果(目标==='DIST'){
      返回grunt.task.run(['建设','连接:DIST:保活']);
    }
    grunt.task.run([
      干净:服务器',
      wiredep',
      并发:服务器',
      自动prefixer',
      连接:livereload',
      '看'
    ]);
  });  grunt.registerTask(服务器,DE preCATED任务。使用服务,而不是任务',函数(目标){
    grunt.log.warn('了`server`任务已经pcated德$ P $使用`咕噜serve`启动服务器。');
    grunt.task.run(['服务:'+目标]);
  });  grunt.registerTask(测试,[
    干净:服务器',
    自动prefixer',
    连接:测试',
    业力
  ]);  grunt.registerTask('打造',[
    干净:DIST',
    wiredep',
    usemin prepare',
    并发:DIST',
    自动prefixer',
    CONCAT,
    ngmin',
    '复制:DIST',
    cdnify',
    cssmin',
    '丑化',
    filerev',
    usemin',
    htmlmin
  ]);  grunt.registerTask(默认,[
    更新:jshint',
    '测试',
    '建立'
  ]);
};

我产生的哟角度发电机项目。这是我的环境:


  • 节点-v:v0.10.25

  • 红宝石-v:宝石2.1.2p95(2014年5月8日改版45877)的x86_64-darwin13.0]

  • 哟-v:1.1.2

  • 宝石列表:

    *当地的宝石*

    的BigDecimal(1.2.4)
    打捆(1.6.2)
    打捆 - 卸载(1.0.2)
    chunky_png(1.3.1)
    指南针(0.12.6)
    可执行钩(1.3.1)
    fssm(0.2.10)
    宝石包装(1.2.4)
    IO-控制台(0.4.2)
    JSON(1.8.1)
    MINITEST(4.7.5)
    迷幻(2.0.5)
    耙(10.1.0)
    的RDoc(4.1.0)
    RubyGems的打捆(1.4.3)
    RVM(1.11.3.9)
    SASS(3.3.8,3.2.19)
    测试单元(2.1.2.0)


  • 咕噜--verison:咕噜-CLI v0.1.13,咕噜v0.4.5


  • 的Mac OS X 10.9

这是我的的package.json

  {
  名:PROJECT1
  版本:0.0.0
  依赖:{},
  devDependencies:{
    咕噜:^ 0.4.1
    咕噜-AUTO prefixer:^ 0.7.3
    咕噜并发:^ 0.5.0
    咕噜-contrib请清洁:^ 0.5.0
    咕噜-的contrib咖啡:^ 0.10.1
    咕噜-的contrib罗盘:〜0.8.0
    咕噜-的contrib-CONCAT:^ 0.4.0
    咕噜-的contrib连接:^ 0.7.1
    咕噜-contrib请复制:^ 0.5.0
    咕噜-的contrib-cssmin:^ 0.9.0
    咕噜-的contrib-htmlmin:^ 0.3.0
    咕噜-的contrib-imagemin:^ 0.7.0
    咕噜-的contrib-jshint:^ 0.10.0
    咕噜-的contrib-丑化:^ 0.4.0
    咕噜-的contrib手表:^ 0.6.1
    咕噜-filerev:^ 0.2.1
    咕噜 - 谷歌-CDN:^ 0.4.0
    咕噜-新:^ 0.7.0
    咕噜-ngmin:^ 0.0.3
    咕噜-svgmin:^ 0.4.0
    咕噜-usemin:^ 2.1.1
    咕噜-wiredep:^ 1.7.0
    jshint时尚的:^ 0.2.0
    负载咕噜任务:^ 0.4.0
    时间咕噜:^ 0.3.1
    咖啡剧本:〜1.7.1
    咕噜-报应:〜0.8.3
    卡玛 - phantomjs-发射:〜0.1.4
    报应:〜0.12.16
    卡玛 - 茉莉花:〜0.1.5
    卡玛 - 咖啡 - preprocessor:〜0.2.1
    报应 - 铬 - 发射:〜0.1.4
    卡玛 - 脚本启动:〜0.1.0
    卡玛 - 火狐-发射:〜0.1.3
    卡玛 - 野生动物园 - 发射:〜0.1.1
    报应-NG-html2js- preprocessor:〜0.1.0
    果报的JUnit记者:〜0.2.2
    咕噜-NG-不变:〜0.5.0
    咕噜-bowercopy:〜1.0.1
    报应覆盖:〜0.2.4
    咕噜-量角器亚军:〜1.0.0
    卡玛 - 茉莉花所赐:〜0.1.1
    咕噜 - 萨斯:0.13.1〜
  },
  引擎: {
    节点:> = 0.10.0
  },
  脚本:{
    测试:咕噜测试
  }
}

这是我的 bower.json

  {
  名:PROJECT1
  版本:0.0.0
  依赖:{
    角:1.3.0-beta.11
    json3:〜3.3.1
    ES5-垫片:〜3.1.0
    jQuery的:〜1.11.1
    引导 - 萨斯官方:〜3.1.1
    引导:〜3.1.1
    角资源:1.3.0-beta.11
    角饼干:1.3.0-beta.11
    角的sanitize:1.3.0-beta.11
    角动画:1.3.0-beta.11
    角触:1.3.0-beta.11
    角路线:1.3.0-beta.11
    FONT-真棒:〜4.1
    强调:〜1.6.0
  },
  devDependencies:{
    角嘲笑:1.3.0-beta.11
    角情景:1.3.0-beta.11
  },
  APPPATH:应用程序
}


解决方案

愚蠢的我!

有关任何人遇到了同样的问题:

我在SCSS文件中有一些进口的错误。在咕噜咕噜的现场重装,它会告诉你,有什么不对。但咕噜的启动过程中起到它只是打破了,并告诉你什么。所以,请检查您SCSS文件的导入和语法。

suddenly my projects stops working with grunt. Unfortunately, I haven't committed my changes for a while into git, so I can't tell whats different.

When I run grunt server --verbose, I get the following output (everything above ... passes with an OK):

...
Running "wiredep" task

Running "wiredep:app" (wiredep) task
Verifying property wiredep.app exists in config...OK
Files: app/index.html
Verifying property wiredep.app.src exists in config...OK

Running "wiredep:sass" (wiredep) task
Verifying property wiredep.sass exists in config...OK
Files: app/styles/analyzer.scss, app/styles/colors.scss, app/styles/login.scss, app/styles/main.scss, app/styles/shared.scss, app/styles/styles.scss, app/styles/tagsinput.scss
Verifying property wiredep.sass.src exists in config...OK

Running "concurrent:server" (concurrent) task
Verifying property concurrent.server exists in config...OK
Files: [no src] -> server
Options: limit=2
    Warning:  Use --force to continue.

        Aborted due to warnings.


Execution Time (2014-06-24 08:34:05 UTC)
loading tasks        8ms  0%
serve                2ms  0%
clean:server        10ms  0%
wiredep:app        242ms  ▇▇▇▇▇▇▇ 4%
wiredep:sass        17ms  0%
concurrent:server   5.3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 95%
Total 5.6s

So, grunt aborts when trying to execute the task concurrent:server. Inside this task, the compass:server task is executed (see the Gruntfile.js below). So, it must have something todo with compass, but I'm not sure if this line Files: [no src] -> server could give more hints to the problem.

This is my Gruntfile.js:

// Generated on 2014-06-16 using generator-angular 0.9.0-1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: [],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'newer:jshint:all', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer'],
        options: {
            spawn: false,
        }
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '<%= yeoman.app %>/scripts/directives/**/*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: false,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: false,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath: new RegExp('^<%= yeoman.app %>/|../')
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: './bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: false
      }
    }
  });


  grunt.loadNpmTasks('grunt-sass');

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }
    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};

I generated the project with the yo angular generator. And this is my environment:

  • node -v: v0.10.25
  • ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
  • yo -v: 1.1.2
  • gem list:

    * LOCAL GEMS *

    bigdecimal (1.2.4) bundler (1.6.2) bundler-unload (1.0.2) chunky_png (1.3.1) compass (0.12.6) executable-hooks (1.3.1) fssm (0.2.10) gem-wrappers (1.2.4) io-console (0.4.2) json (1.8.1) minitest (4.7.5) psych (2.0.5) rake (10.1.0) rdoc (4.1.0) rubygems-bundler (1.4.3) rvm (1.11.3.9) sass (3.3.8, 3.2.19) test-unit (2.1.2.0)

  • grunt --verison: grunt-cli v0.1.13, grunt v0.4.5

  • Mac OS X 10.9

This is my package.json:

{
  "name": "project1",
  "version": "0.0.0",
  "dependencies": {},
  "devDependencies": {
    "grunt": "^0.4.1",
    "grunt-autoprefixer": "^0.7.3",
    "grunt-concurrent": "^0.5.0",
    "grunt-contrib-clean": "^0.5.0",
    "grunt-contrib-coffee": "^0.10.1",
    "grunt-contrib-compass": "~0.8.0",
    "grunt-contrib-concat": "^0.4.0",
    "grunt-contrib-connect": "^0.7.1",
    "grunt-contrib-copy": "^0.5.0",
    "grunt-contrib-cssmin": "^0.9.0",
    "grunt-contrib-htmlmin": "^0.3.0",
    "grunt-contrib-imagemin": "^0.7.0",
    "grunt-contrib-jshint": "^0.10.0",
    "grunt-contrib-uglify": "^0.4.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-filerev": "^0.2.1",
    "grunt-google-cdn": "^0.4.0",
    "grunt-newer": "^0.7.0",
    "grunt-ngmin": "^0.0.3",
    "grunt-svgmin": "^0.4.0",
    "grunt-usemin": "^2.1.1",
    "grunt-wiredep": "^1.7.0",
    "jshint-stylish": "^0.2.0",
    "load-grunt-tasks": "^0.4.0",
    "time-grunt": "^0.3.1",
    "coffee-script": "~1.7.1",
    "grunt-karma": "~0.8.3",
    "karma-phantomjs-launcher": "~0.1.4",
    "karma": "~0.12.16",
    "karma-jasmine": "~0.1.5",
    "karma-coffee-preprocessor": "~0.2.1",
    "karma-chrome-launcher": "~0.1.4",
    "karma-script-launcher": "~0.1.0",
    "karma-firefox-launcher": "~0.1.3",
    "karma-safari-launcher": "~0.1.1",
    "karma-ng-html2js-preprocessor": "~0.1.0",
    "karma-junit-reporter": "~0.2.2",
    "grunt-ng-constant": "~0.5.0",
    "grunt-bowercopy": "~1.0.1",
    "karma-coverage": "~0.2.4",
    "grunt-protractor-runner": "~1.0.0",
    "karma-jasmine-given": "~0.1.1",
    "grunt-sass": "~0.13.1"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "grunt test"
  }
}

And this is my bower.json:

{
  "name": "project1",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.3.0-beta.11",
    "json3": "~3.3.1",
    "es5-shim": "~3.1.0",
    "jquery": "~1.11.1",
    "bootstrap-sass-official": "~3.1.1",
    "bootstrap": "~3.1.1",
    "angular-resource": "1.3.0-beta.11",
    "angular-cookies": "1.3.0-beta.11",
    "angular-sanitize": "1.3.0-beta.11",
    "angular-animate": "1.3.0-beta.11",
    "angular-touch": "1.3.0-beta.11",
    "angular-route": "1.3.0-beta.11",
    "font-awesome": "~4.1",
    "underscore": "~1.6.0"
  },
  "devDependencies": {
    "angular-mocks": "1.3.0-beta.11",
    "angular-scenario": "1.3.0-beta.11"
  },
  "appPath": "app"
}

解决方案

Stupid me!

For anybody encountering the same issue:

I had some import errors in my SCSS files. During the live reload of grunt, it would tell you that there is something wrong. But during the startup of grunt serve it just breaks and tells you nothing. So, check your imports and syntax of your SCSS files.

这篇关于咕噜服务:并发:服务器中止由于警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆