我在我的项目中使用Swiip / generator-gulp-angular generator。当我执行 gulp serve 时,一切都像魅力一样,但当我执行 gulp serve:dist 时,我收到此错误:
vendor.js:13842未捕获错误:[$ injector:modulerr]失败 实例化模块prometheus由于:错误:[$ injector:modulerr] 由于以下原因无法实例化模块ngStorage:错误: [$ injector:nomod]模块' ngStorage'不可用!你要么 拼写错误的模块名称或忘记加载它。如果注册了 模块确保您将依赖项指定为第二个 论点。 http://errors.angularjs.org/1.5.7/ $注射器/ NOMOD?P0 = ngStorage 在http://localhost:3000/scripts/vendor-7ba12c98b6.js:31:376 ......
我实际上对此没有任何线索。
注意 我已经看过这个问题了:https://github.com/Swiip/generator-gulp-angular/issues/715
inject.js
https://myfirebasetest.firebaseio.com
build.js
'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var $ = require('gulp-load-plugins')();
var wiredep = require('wiredep').stream;
var _ = require('lodash');
var browserSync = require('browser-sync');
gulp.task('inject-reload', ['inject'], function() {
browserSync.reload();
});
gulp.task('inject', ['scripts', 'styles'], function () {
var injectStyles = gulp.src([
path.join(conf.paths.tmp, '/serve/app/**/*.css'),
path.join('!' + conf.paths.tmp, '/serve/app/vendor.css')
], { read: false });
var injectScripts = gulp.src([
path.join(conf.paths.src, '/app/**/*.module.js'),
path.join(conf.paths.src, '/app/**/*.js'),
path.join('!' + conf.paths.src, '/app/**/*.spec.js'),
path.join('!' + conf.paths.src, '/app/**/*.mock.js'),
])
.pipe($.angularFilesort()).on('error', conf.errorHandler('AngularFilesort'));
var injectOptions = {
ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')],
addRootSlash: false
};
return gulp.src(path.join(conf.paths.src, '/*.html'))
.pipe($.inject(injectStyles, injectOptions))
.pipe($.inject(injectScripts, injectOptions))
.pipe(wiredep(_.extend({}, conf.wiredep)))
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve')));
});