' TypeError:dest.on不是函数'这个反应设置 - 为什么?

时间:2017-08-09 21:19:19

标签: reactjs build ecmascript-6 gulp

我试图让这个简单的网站与React和Gulp一起使用,但是收到错误:" TypeError:dest.on不是函数"在终端。不知道如何解决这个问题?有任何想法吗?谢谢你的帮助。

Gulp文件:

// packages
const gulp = require('gulp'),
    babel = require('gulp-babel'),
    sourcemaps = require('gulp-sourcemaps');
    concat = require('concat');

// build all the JavaScript things
gulp.task('default', function() {
    var src = [
        './src/script/*.js',
        './src/components/*.jsx'
        ];
    return gulp.src(src)
                .pipe(sourcemaps.init())
                .pipe(babel({
                    presets: [
                        'es2015',
                        'react'
                        ]
                    }))
                .pipe(concat('dw.js'))
                .pipe(gulp.dest('./dist/script'));
});

以下是我在终端中看到的错误:

$ gulp
[14:17:30] Requiring external module babel-core/register
[14:17:30] Using gulpfile ~/Dropbox/mashydesign/designSite/gulp test 3/gulpfile.babel.js
[14:17:30] Starting 'default'...
[14:17:30] 'default' errored after 18 ms
[14:17:30] TypeError: dest.on is not a function
    at DestroyableTransform.Readable.pipe (/Users/MM2887/Dropbox/mashydesign/designSite/gulp test 3/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:557:8)
    at Gulp.<anonymous> (/Users/MM2887/Dropbox/mashydesign/designSite/gulp test 3/gulpfile.babel.js:21:6)
    at module.exports (/Users/MM2887/Dropbox/mashydesign/designSite/gulp test 3/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/MM2887/Dropbox/mashydesign/designSite/gulp test 3/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/MM2887/Dropbox/mashydesign/designSite/gulp test 3/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/MM2887/Dropbox/mashydesign/designSite/gulp test 3/node_modules/orchestrator/index.js:134:8)
    at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11) /Users/MM2887/Dropbox/mashydesign/designSite/gulp test 3/node_modules/concat/index.js:17
        const fileList = files.map(f => path_1.join(folder, f));
                              ^
TypeError: Cannot read property 'map' of undefined

0 个答案:

没有答案