我使用Angular和gulp。当我进行" gulp test"时,我收到了错误" ReferenceError:无法找到变量:require in /bower_components/gulp-ng-config/gulp-ng-config.js :3
吞/ config.js
'use strict';
var path = require('path'),
gulp = require('gulp'),
conf = require('./conf'),
gulpNgConfig = require('gulp-ng-config');
gulp.task('config', function () {
gulp.src(path.join(conf.paths.src, '/app/config.json'))
.pipe(gulpNgConfig('EnvConf', {
environment: 'local'
}))
.pipe(gulp.dest(path.join(conf.paths.src, '/app/')));
});
gulp.task('config:build', function () {
gulp.src(path.join(conf.paths.src, '/app/config.json'))
.pipe(gulpNgConfig('EnvConf', {
environment: 'production'
}))
.pipe(gulp.dest(path.join(conf.paths.src, '/app/')));
});
吞/ server.js
gulp.task('serve', ['config','watch'], function() {
browserSyncInit([path.join(conf.paths.tmp, '/serve'), conf.paths.src]);
});
gulp.task('serve:dist', ['config:build','build'], function() {
browserSyncInit(conf.paths.dist);
});
gulp.task('serve:e2e', ['config','inject'], function() {
browserSyncInit([conf.paths.tmp + '/serve', conf.paths.src], []);
});
gulp.task('serve:e2e-dist', ['config:build','build'], function() {
browserSyncInit(conf.paths.dist, []);
});
我尝试使用node v6.1.0和v5.10.1。
答案 0 :(得分:0)
您似乎已将gulp-ng-conig
安装为 bower 依赖项。
这是一个gulp插件,它是节点依赖。
尝试使用npm install gulp-ng-config --save