我一直收到一个错误,试图将主弓形文件插入我的构建文件夹index.html中。
我的代码如下所示:
//requires
var gulp = require('gulp');
var inject = require('gulp-inject');
var config = require('./gulp-config');
var mainBowerFiles = require('main-bower-files');
gulp.task('default', ['move'], function() {
return gulp
.src(config.buildFolder + config.indexFile)
.pipe(
inject(
gulp.src( mainBowerFiles() ), {base: './bower_components'}
)
)
.pipe(gulp.dest(config.buildFolder));
});
gulp.task('move', function() {
return gulp
.src(config.indexFile)
.pipe(gulp.dest(config.buildFolder));
});这将给出以下错误:
SyntaxError: Unexpected end of input 发布于 2015-05-01 00:32:55
所以这一次我真的被窃听了(我偷看了一下NPM包代码,看看是否真的有一个意外的输入错误,但是这个错误是我的错)。
问题是在我的文件结构中,我有一个空的.bowerrc文件,它是我通过输入$ touch .bowerrc从终端生成的。只需加上
{
"directory": "(your bower components folder here as valid JSON)"
}还有..。错误消失了!希望这能省去别人的麻烦,就像它给我带来的麻烦一样。
https://stackoverflow.com/questions/29979990
复制相似问题