Not able to spawn gulp task from Electron Package


#1

Hi all: the code is:

const path = require('path');
const childProcess = require('child_process');

let gulpBinPath = path.resolve(path.join(__dirname, './node_modules/gulp-cli/bin/gulp.js'));

let mainWindow = new BrowserWindow({
        width: 800,
        height: 600,
        titleBarStyle: 'hidden'
});
mainWindow.webContents.on('did-finish-load', function () {
        let child = childProcess.spawn(gulpBinPath, ['-v']);
        child.stdout.on('data', function(data){
            mainWindow.webContents.send('cb', data);
        });
});

I want to run gulp -v, but it throw the error: Error: spawn /Users/user/Desktop/electron-test/electron-test-darwin-x64/electron-test.app/Contents/Resources/app/node_modules/gulp-cli/bin/gulp ENOENT.

I don’t know how to resolve it, and all the answer that i can search is not to fixed this problem. Please help me.