Angularjs 运行gulp:dist时出现模块错误

Angularjs 运行gulp:dist时出现模块错误,angularjs,gulp,bower,Angularjs,Gulp,Bower,我为我的应用程序配置了gulp 一边大口大口大口地跑,一边为一切服务 但当我大口大口发球时:dist 我正在犯错误 Uncaught Error: [$injector:modulerr] Failed to instantiate module xxx due to: Error: [$injector:nomod] Module 'xxx' is not available! You either misspelled the module name or forgot to load it

我为我的应用程序配置了gulp

一边大口大口大口地跑,一边为一切服务

但当我大口大口发球时:dist

我正在犯错误

Uncaught Error: [$injector:modulerr] Failed to instantiate module xxx due to:
Error: [$injector:nomod] Module 'xxx' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
请帮我做这个

我的吞咽文件在下面

/**
*  Welcome to your gulpfile!
*  The gulp tasks are splitted in several files in the gulp directory
*  because putting all here was really too long
*/

'use strict';

var gulp = require('gulp');
var wrench = require('wrench');

/**
*  This will load all js or coffee files in the gulp directory
*  in order to load all gulp tasks
*/
wrench.readdirSyncRecursive('./gulp').filter(function(file) {
return (/\.(js|coffee)$/i).test(file);
}).map(function(file) {
 require('./gulp/' + file);
});


/**
 *  Default task clean temporaries directories and launch the
 *  main optimization build task
 */
gulp.task('default', ['clean'], function () {
  gulp.start('build');
});
和gulp文件夹中的我的build.js文件

'use strict';

var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');

var $ = require('gulp-load-plugins')({
    pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
});

gulp.task('partials', function () {
    return gulp.src([
        path.join(conf.paths.src, '/app/**/*.html'),
        path.join(conf.paths.tmp, '/serve/app/**/*.html')
    ])
    .pipe($.minifyHtml({
        empty: true,
        spare: true,
        quotes: true
    }))
    .pipe($.angularTemplatecache('templateCacheHtml.js', {
        module: 'xxx',
        root: 'app',
        templateHeader: '(function() { angular.module("<%= module %>"<%= standalone %>).run(["$templateCache", function($templateCache) {',
        templateFooter: '}]);})();'
    }))
    .pipe(gulp.dest(conf.paths.tmp + '/partials/'));
 });

 gulp.task('html', ['inject', 'partials'], function () {
      var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), { read: false });
  var partialsInjectOptions = {
      starttag: '<!-- inject:partials -->',
      ignorePath: path.join(conf.paths.tmp, '/partials'),
      addRootSlash: false
  };

  var htmlFilter = $.filter('*.html', { restore: true });
  var jsFilter = $.filter('**/*.js', { restore: true });
  var cssFilter = $.filter('**/*.css', { restore: true });
  var assets;

  return gulp.src(path.join(conf.paths.tmp, '/serve/*.html'))
     .pipe($.inject(partialsInjectFile, partialsInjectOptions))
     .pipe(assets = $.useref.assets())
     .pipe($.rev())
     .pipe(jsFilter)
     .pipe($.sourcemaps.init())
     .pipe($.ngAnnotate())
     .pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error',     conf.errorHandler('Uglify'))
     .pipe($.sourcemaps.write('maps'))
     .pipe(jsFilter.restore)
     .pipe(cssFilter)
     .pipe($.sourcemaps.init())
     .pipe($.replace('../../bower_components/material-design-iconfont/iconfont/', '../fonts/'))
     .pipe($.minifyCss({ processImport: false }))
     .pipe($.sourcemaps.write('maps'))
     .pipe(cssFilter.restore)
     .pipe(assets.restore())
     .pipe($.useref())
     .pipe($.revReplace())
     .pipe(htmlFilter)
     .pipe($.minifyHtml({
          empty: true,
          spare: true,
          quotes: true,
          conditionals: true
      }))
     .pipe(htmlFilter.restore)
     .pipe(gulp.dest(path.join(conf.paths.dist, '/')))
     .pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true              }));
   });

   // Only applies for fonts from bower dependencies
   // Custom fonts are handled by the "other" task
   gulp.task('fonts', function () {
   return gulp.src($.mainBowerFiles().concat('bower_components/material-design-iconfont/iconfont/*'))
     .pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
     .pipe($.flatten())
     .pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));
   });

   gulp.task('other', function () {
       var fileFilter = $.filter(function (file) {
       return file.stat.isFile();
   });

   return gulp.src([
       path.join(conf.paths.src, '/**/*'),
       path.join('!' + conf.paths.src, '/**/*.{html,css,js}')
   ])
   .pipe(fileFilter)
   .pipe(gulp.dest(path.join(conf.paths.dist, '/')));
 });

 gulp.task('clean', function () {
     return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp,     '/')]);
 });

 gulp.task('build', ['html', 'fonts', 'other']);
“严格使用”;
var path=require('path');
var gulp=需要(“gulp”);
var conf=require('./conf');
var$=require('gulp-load-plugins'))({
模式:['gulp-*','main bower files','uglify save license','del']
});
吞咽任务('partials',function(){
回灌([
join(conf.path.src,'/app/***.html'),
join(conf.path.tmp,“/service/app/***.html”)
])
.pipe($.minifyHtml({
空:是的,
是的,
引用:对
}))
.pipe($.angularTemplatecache('templateCacheHtml.js'{
模块:“xxx”,
root:'应用',
templateHeader:'(函数(){angular.module(“”)。运行([“$templateCache”),函数($templateCache){',
模板页脚:'}];}();'
}))
.pipe(gulp.dest(conf.path.tmp+'/partials/');
});
gulp.task('html',['inject','partials',],function(){
var partialsInjectFile=gulp.src(path.join(conf.path.tmp,'/partials/templateCacheHtml.js'),{read:false});
var partialsInjectOptions={
开始标记:“”,
ignorePath:path.join(conf.path.tmp,“/partials”),
addRootSlash:false
};
var htmlFilter=$.filter('*.html',{restore:true});
var jsFilter=$.filter('***.js',{restore:true});
var cssFilter=$.filter('***.css',{restore:true});
var资产;
返回gulp.src(path.join(conf.paths.tmp,'/service/*.html'))
.pipe($.inject(partialsInjectFile,partialsInjectOptions))
.pipe(资产=$.useref.assets())
.pipe($.rev())
.pipe(jsFilter)
.pipe($.sourcemaps.init())
.pipe($.ngAnnotate())
.pipe($.uglify({preserveComents:$.uglifySaveLicense})).on('error',conf.errorHandler('uglify'))
.pipe($.sourcemaps.write('maps'))
.pipe(jsFilter.restore)
.管道(cssFilter)
.pipe($.sourcemaps.init())
.pipe($.replace('../../bower_组件/材质设计ICont/ICont/','../fonts/'))
.pipe($.minifyCss({processImport:false}))
.pipe($.sourcemaps.write('maps'))
.pipe(cssFilter.restore)
.pipe(assets.restore())
.pipe($.useref())
.pipe($.revReplace())
.管道(htmlFilter)
.pipe($.minifyHtml({
空:是的,
是的,
语录:没错,
条件句:true
}))
.pipe(htmlFilter.restore)
.pipe(gulp.dest(path.join(conf.paths.dist,“/”))
.pipe($.size({title:path.join(conf.path.dist,'/')),showFiles:true});
});
//仅适用于bower依赖项中的字体
//自定义字体由“其他”任务处理
gulp.task('font',function(){
return gulp.src($.mainBowerFiles().concat('bower\u组件/材料设计图标/图标/*'))
.pipe($.filter('***.{eot,svg,ttf,woff,woff2}'))
.pipe($.flant())
.pipe(gulp.dest(path.join(conf.paths.dist,“/font/”));
});
吞咽任务('other',函数(){
var fileFilter=$.filter(函数(文件){
返回file.stat.isFile();
});
回灌([
join(conf.path.src,'/***'),
join(“!”+conf.paths.src,“/***.{html,css,js}”)
])
.管道(文件过滤器)
.pipe(gulp.dest(path.join(conf.paths.dist,“/”));
});
吞咽任务('clean',函数(){
返回$.del([path.join(conf.paths.dist,'/')、path.join(conf.paths.tmp,'/'))];
});
任务('build',['html','font','other']);

您的问题似乎与我所面临的问题相似。 尝试检查定义了routeConfig的js文件。它可能缺少某些必需的功能

或者检查用于注入的@ngInject注释。
可能是您错误地丢失或注释了带有此注释的函数

请同时共享gulp文件。我共享了我的gulp文件我也共享了build.js文件