@@ -53,21 +53,32 @@ public Task<bool> ExecuteAsync()
5353
5454 DeployEmbeddedElectronFiles . Do ( tempPath ) ;
5555
56- Console . WriteLine ( "Start npm install..." ) ;
57- ProcessHelper . CmdExecute ( "npm install" , tempPath ) ;
56+ var checkForNodeModulesDirPath = Path . Combine ( tempPath , "node_modules" ) ;
5857
59- Console . WriteLine ( "Start npm install electron-packager..." ) ;
60-
61- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
58+ if ( Directory . Exists ( checkForNodeModulesDirPath ) == false )
6259 {
63- // Works proper on Windows...
64- ProcessHelper . CmdExecute ( "npm install electron-packager --global" , tempPath ) ;
60+ Console . WriteLine ( "node_modules missing in: " + checkForNodeModulesDirPath ) ;
61+
62+ Console . WriteLine ( "Start npm install..." ) ;
63+ ProcessHelper . CmdExecute ( "npm install" , tempPath ) ;
64+
65+ Console . WriteLine ( "Start npm install electron-packager..." ) ;
66+
67+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
68+ {
69+ // Works proper on Windows...
70+ ProcessHelper . CmdExecute ( "npm install electron-packager --global" , tempPath ) ;
71+ }
72+ else
73+ {
74+ // ToDo: find another solution or document it proper
75+ // GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48
76+ Console . WriteLine ( "Electron Packager - make sure you invoke 'sudo npm install electron-packager --global' at " + tempPath + " manually. Sry." ) ;
77+ }
6578 }
6679 else
6780 {
68- // ToDo: find another solution or document it proper
69- // GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48
70- Console . WriteLine ( "Electron Packager - make sure you invoke 'sudo npm install electron-packager --global' at " + tempPath + " manually. Sry." ) ;
81+ Console . WriteLine ( "Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath ) ;
7182 }
7283
7384 Console . WriteLine ( "Build Electron Desktop Application..." ) ;
0 commit comments