Skip to content

Gulp throws error Can only pipe to one destination #2820

@rvab

Description

@rvab

What were you expecting to happen?

The gulp task should be executed successfully.

What actually happened?

Gulp is throwing the below error

Can only pipe to one destination 

Sample code

function generateHTML(path, withStyles) {
  let stream = src(path.html.src, {
    base: '.',
  });

  if (argv.production) {
    stream = minifyHTMLReferences(stream, withStyles);
  }

  stream.pipe(dest(path.html.dest));
  return stream;
}
const gulpWatch = series(
 generateHTML
 ...othertask
)
export { gulpWatch as watch }

Terminal output / screenshots

$ gulp watch

output

Error: Can only pipe to one destination
    at ReadableState.pipe (path-to-node_modules/node_modules/streamx/index.js:260:13)
    at Transform.pipe (path-to-node_modules/node_modules/streamx/index.js:722:25)
    at resumer (path-to-node_modules/node_modules/stream-exhaust/index.js:12:12)
    at asyncRunner (path-to-node_modules/node_modules/async-done/index.js:65:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

Please provide the following information:

  • OS & version: MacOS Sonoma 14.3.1
  • node version: v20.17.0
  • npm version: 10.8.2
  • gulp version: 5.0.0

Additional information

The below code works but when dest is set after creating stream, the task fails

function generateHTML(path, withListViewStyles) {
  return src(path.html.src, {
    base: '.',
  }).pipe(dest(path.html.dest));

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions