2017-07-17 7 views
1

Ich arbeite an einer Elektronen-App, die Schluckaufgaben über GUI steuert. Sie klicken auf eine Aufgabe und es läuft. Ziemlich einfaches Zeug. Auf macOS, wenn ich npm starten führen Sie es ganz gut läuft, aber wenn ich es mit elektronen Packager verpacken, bekomme ich diesen Fehler:electron-packager spawn ENOENT

Uncaught Exception: 
Error: spawn gulp ENOENT 
    at exports._errnoException (util.js:1022:11) 
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) 
    at onErrorNT (internal/child_process.js:359:16) 
    at _combinedTickCallback (internal/process/next_tick.js:74:11) 
    at process._tickCallback (internal/process/next_tick.js:98:9) 

Dies ist der Code:

exports.runTask = (taskName, projPath) => { 
    const cp = spawn('gulp', [ taskName ], {cwd: projPath}); 
    cp.stdout.setEncoding('utf8'); 
    cp.stdout.on('data', data => { 
     console.log(data); 
     mainWindow.webContents.send('task-console-data', data); 
    }); 

    cp.stderr.setEncoding('utf8'); 
    cp.stderr.on('data', data => { 
     console.error(data); 
     displayNotification({text: `[error] ${data}`}); 
     mainWindow.webContents.send('task-console-data', `[error] ${data}`); 
    }); 

    cp.on('exit', code => { 
     if (code === 0) { 
      displayNotification({ 
      title: 'gulp', 
      subtitle: 'Finished running tasks' 
      }); 
     } else if (!code || code === null) { 
      return; 
     } else { 
      console.error(`Exited with error code ${code}`); 

      displayNotification({ 
       title: 'gulp', 
       subtitle: `Exited with error code ${code}`, 
       sound: 'Basso' 
      }); 
     } 
    }); 
}; 

Antwort