To start WebPack (which is in the parent folder) I use Gulp, but as soon as I try to go to the parent folder in the path, I get an error.

Gulp

var spawn = require('child_process').spawn; gulp.task('_Scada2', function (done) { spawn('webpack', [], { cwd: '../../Scada.Web/' }) .on('close', done); }); 

I get an error

 [14:20:47] '_Scada2' errored after 4.47 ms [14:20:47] Error: spawn webpack ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19) at onErrorNT (internal/child_process.js:406:16) at process._tickCallback (internal/process/next_tick.js:63:19) Процесс завершен с кодом 1. 
  • Does webpack only lie in your PATH? - Pavel Mayorov
  • It is installed globally, so I think you can call it that way. When I install Gulp in the same folder as Webpack, it ideally starts - Yuri Bezrukov

1 answer 1

ENOENT appears when it is impossible to find the executive file to run. In this case, you need to use either the npx webpack , or use the official method from the documentation https://webpack.js.org/guides/integrations/#gulp

 var gulp = require('gulp'); var webpack = require('webpack-stream'); gulp.task('default', function() { return gulp.src('src/entry.js') .pipe(webpack({ // Any configuration options... })) .pipe(gulp.dest('dist/')); });