[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found error: TypeError: Object function () ... has no method 'on' #3

Closed
BrainCrumbz opened this issue Oct 13, 2014 · 3 comments
Closed

Comments

@BrainCrumbz
Copy link

I'm preparing a gulpfile using, among others, the gulp-6to5 plugin. It does not seem to be a transpiling issue (see babel/babel#58).

When running the following 'build' gulp task (sixToFive is 'gulp-6to5'):

var config = { production: true };

gulp.task('build', ['setup', 'clean', 'compile']);
// ...
gulp.task('compile', function () {
  var compress = lazypipe()
    .pipe(concat, 'all.js')
    .pipe(uglify);

  return gulp.src('src/lib/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(sixToFive())
    .pipe(gulpif(config.production, compress))
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest(paths.dist));
});

I got the following error:

[03:47:06] 'compile' errored after 13 ms
[03:47:06] TypeError: Object function () {
                                validateSteps(steps);
                                return combine.apply(null, steps.map(function(t) {
                                        return t.task.apply(null, t.args);
                                }));
                        } has no method 'on'
    at DestroyableTransform.Readable.pipe (..rootDir..\node_modules\gulp-6to5\node_modules\through2\node_modules\read
able-stream\lib\_stream_readable.js:516:8)
    at Gulp.gulp.task.mochaOptions.ui (..rootDir..\gulpfile.js:54:6)
    at module.exports (..rootDir..\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (..rootDir..\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (..rootDir..\node_modules\gulp\node_modules\orchestrator\index.js:214:10)
    at ..rootDir..\node_modules\gulp\node_modules\orchestrator\index.js:279:18
    at finish (..rootDir..\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:21:8)
    at cb (..rootDir..\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:29:3)
    at Gulp.<anonymous> (..rootDir..\gulpfile.js:43:3)
    at module.exports (..rootDir..\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)

(I replaced with ..rootDir.. here, just not to show long paths in the post)

When config.production evaluates to false, no error shows up.

@sindresorhus
Copy link
Member

Does it fail without the gulpif call? If no, then the problem is definitely not with this plugin.

return gulp.src('src/lib/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(sixToFive())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest(paths.dist));

@BrainCrumbz
Copy link
Author

If the gulpif call is there, and if its condition evaluates to false, everything goes fine. If condition evaluates to true, then the error shows up. Does this give you enough details to figure out whether it's a matter of this plugin or not?

@sindresorhus
Copy link
Member

Yeah, not this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants