2016-02-28 37 views
7

ho cercando di confezionare la mia app utilizzando elettrone-Packager e questo comando:Electron-packager: non riesce a trovare il modulo

electron-packager . FooBar --platform=darwin --arch=x64 --version=0.36.9 

(sto usando MacOSX) si crea l'applicazione, ma quando l'eseguo ottengo un pop-up che mostra questo:

eccezione non identificata:

Error: Cannot find module '/Users/myUser/myApp/FooBar-darwin-x64/FooBar.app/Contents/Resources/app/app:/host/menu.html' 
    at Function.Module._resolveFilename (module.js:338:15) 
    at Function.Module._load (module.js:289:25) 
    at Object.<anonymous> (/Users/myUser/myApp/FooBar-darwin-x64/FooBar.app/Contents/Resources/atom.asar/browser/lib/init.js:158:8) 
    at Module._compile (module.js:425:26) 
    at Object.Module._extensions..js (module.js:432:10) 
    at Module.load (module.js:356:32) 
    at Function.Module._load (module.js:313:12) 
    at Function.Module.runMain (module.js:457:10) 
    at startup (node.js:151:18) 
    at node.js:1007:3 

in questa cartella: "/Users/myUser/myApp/FooBar-darwin-x64/FooBar.app/Contents/Resources/app" c'è la voce che punta al file html "menu.html", ma se SME elettrone non riesco a trovarlo ...

questo è il mio app.js:

var app = require('app'); // Module to control application life. 
var BrowserWindow = require('browser-window'); // Module to create native browser window. 

var mainWindow = null; 


// This method will be called when Electron has done everything 
// initialization and ready for creating browser windows. 
app.on('ready', function() { 

    // Create the browser window. 
    mainWindow = new BrowserWindow({width: 1024, height: 768}); 

    // and load the index.html of the app. 
    mainWindow.loadUrl('file://' + __dirname + '/menu.html'); 

    mainWindow.openDevTools({detach: true}); 

    // Emitted when the window is closed. 
    mainWindow.on('closed', function() { 
    mainWindow = null; 
    }); 

}); 

Avete idee su quello che potrebbe essere il problema?

Grazie.

risposta

10

Due cose che si possono provare:

  • assicurarsi che ogni nodo moduli che è necessario eseguire sulla produzione accumulo aggiunte in dependencies in package.json. Ad esempio: npm install <module_name> --save
  • Come funziona quando --asar = false (Maggiori informazioni presso https://github.com/electron-userland/electron-packager)
+0

Grazie, c'è stato un errore nel file package.json – navy1978

+0

Ho cambiato il mio 'devDependencies' in' dependencies' e sembra che funzioni! –

0

Per me il problema era che le dipendenze dei moduli sono stati elencati nella "devDependencies" in package.json

Spostandoli in "dipendenze" e eseguendo l'installazione di npm di nuovo risolto il problema.

Problemi correlati