homerboy homerboy - 6 months ago 67
Node.js Question

Unexpected token .pipe in Gulp

This is a similar question to: unexpected token .pipe in gulpfile.js but I still don't have an exact solution to this issue.

I am receiving an unexpected token at the

.
in
.pipe
when I run
gulp
. Here is my gulpfile.js:

var gulp = require('gulp');
var react = require('gulp-react');
var concat = require('gulp-concat');

gulp.task('default', function() {
return gulp.src('src/**');
.pipe(react())
.pipe(concat('application.js'))
.pipe(gulp.dest('./'))
});


And here is my
package.json
:

{
"name": "react-project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-react": "^3.1.0",
"latest-version": "^2.0.0"
}
}


And this is how I installed gulp, gulp-react, and gulp-concat:


npm install --save gulp gulp-react gulp-concat


Any help would be awesome.

Answer

Cut the semi-colon at the end of the line with return, before pipe:

gulp.task('default', function() {
    return gulp.src('src/**'); // HERE
        .pipe(react())
        .pipe(concat('application.js'))
        .pipe(gulp.dest('./'))
});
Comments