SyntaxError: Unexpected end of input error using Gulp package and main-bower-files

I keep getting an error while trying to embed the main bower files in my build.html folder

I am using main-bower-files NPM package .

My code is as follows:

//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)); }); 

which gives me the following error

 SyntaxError: Unexpected end of input 
+6
source share
1 answer

So it really listened to me (I looked under the hood in the NPM package code to see if there was an unexpected end to the input error, but the error was my error).

The problem is in my file structure, I had an empty .bowerrc file, which I generated from the terminal by typing $ touch .bowerrc . Just add

 { "directory": "(your bower components folder here as valid JSON)" } 

and ... the error has disappeared! I hope this saves someone as much trouble as it caused me.

+10
source

Source: https://habr.com/ru/post/986335/


All Articles