gulp-concat没有将我的jsx文件转换为js with reactify

时间:2016-02-18 08:05:32

标签: express gulp browserify jsx reactify

我是Gulp的新手,我正在尝试使用browserify将jsx文件转换为js文件并重新执行但是我得到了错误。我的gulp文件看起来像这样:

var gulp = require('gulp'),
    nodemon = require('gulp-nodemon'),
    browserify = require('browserify'),
    reactify = require('reactify'),
    concat = require('gulp-concat'),

gulp.task('bundler', function() {
    gulp.src('public/javascript/app.jsx')
        .pipe(browserify({
            transform: 'reactify',
            extensions: ['.jsx']
        }))
        .pipe(concat('main.js'))
        .pipe(gulp.dest('./dist/javascript'));
});

gulp.task('server', function() {
    nodemon({
        script: 'server.js',
        ext: 'html js',
        watch: 'public'})
        .on('restart', function() {
            console.log('Restarted');
        });
});

gulp.task('default', ['bundler', 'server']);

但是我收到了这个错误:

TypeError: gulp.src(...).pipe(...).pipe is not a function
    at Gulp.<anonymous> (/Users/H/WebstormProjects/royalp/gulpfile.js:16:10)
    at module.exports (/Users/H/WebstormProjects/royalp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/H/WebstormProjects/royalp/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/H/WebstormProjects/royalp/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/H/WebstormProjects/royalp/node_modules/orchestrator/index.js:134:8)
    at /usr/local/lib/node_modules/gulp-cli/index.js:133:20
    at nextTickCallbackWith0Args (node.js:433:9)
    at process._tickCallback (node.js:362:13)
    at Function.Module.runMain (module.js:433:11)
    at startup (node.js:141:18)
/Users/H/WebstormProjects/royalp/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:523
    dest.end();
         ^

TypeError: dest.end is not a function
    at DestroyableTransform.onend (/Users/H/WebstormProjects/royalp/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:523:10)
    at DestroyableTransform.g (events.js:261:16)
    at emitNone (events.js:73:20)
    at DestroyableTransform.emit (events.js:167:7)
    at /Users/H/WebstormProjects/royalp/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:965:16
    at nextTickCallbackWith0Args (node.js:433:9)
    at process._tickCallback (node.js:362:13)

之前工作正常,但突然间它停止了工作。我一直试图解决它几个小时但我找不到它不起作用的原因,我真的很感激一些帮助。

0 个答案:

没有答案
相关问题