exercism / gui

MIT License
22 stars 13 forks source link

sort-of failed Windows installer creation #37

Closed robphoenix closed 8 years ago

robphoenix commented 8 years ago

I've just been trying to create a Windows installer using electron-winstaller, but it's failing due to the use of - in exercism-gui.

On Windows 7, I downloaded the exercism-gui-win32-x64-v0.1.0-beta.1.zip and unpacked it. In this directory I ran npm install --save electron-winstaller and added in the following build.js script to the root dir:

var electronInstaller = require('electron-winstaller');

resultPromise = electronInstaller.createWindowsInstaller({
  appDirectory: 'C:\\Users\\robertph\\Downloads\\exercism-gui-win32-x64-v0.1.0-beta.1\\exercism-gui-win32-x64',
  outputDirectory: 'C:\\Users\\robertph\\Downloads\\exercism-gui-win32-x64-v0.1.0-beta.1\\dist',
  authors: 'exercism',
});

resultPromise.then(() => console.log("It worked!"), (e) => console.log(`No dice: ${e}`));

then in the root dir ran node .\build.js getting the following error output:

No dice: Error: Failed with exit code: 4294967295
Output:

System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to compile WiX template, command invoked was: 'candle.exe -nologo -ext WixNetFxExtension -out "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wixobj" "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs"'

Output was:
Setup.wxs
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(20) : error CNDL0014 : The Component/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(21) : error CNDL0014 : The File/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(34) : error CNDL0014 : The ComponentRef/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
   at Squirrel.Update.Program.<createMsiPackage>d__20.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to compile WiX template, command invoked was: 'candle.exe -nologo -ext WixNetFxExtension -out "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wixobj" "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs"'

Output was:
Setup.wxs
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(20) : error CNDL0014 : The Component/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(21) : error CNDL0014 : The File/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(34) : error CNDL0014 : The ComponentRef/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
   at Squirrel.Update.Program.<createMsiPackage>d__20.MoveNext()<---

The specific error is 'exercism-gui.exe', is not a legal identifier, I tried changing exercism-gui to exercism_gui in a few places, including in the Setup.wxs file that is created, where I believe the illegal identifier is, but as it is overwritten each time this has no effect. I don't know where exercism-gui would need to be changed for this to take effect. I've not run the ember build command from this dir as I've run into various difficulties getting the electron program set up on windows, which I'll open separate issues for.

A Setup.exe is created in the dist directory that when double-clicked runs the exercism-gui app, & installs a bunch of files in my AppData directory, but not the actual app.

If I get the time, I'll try a few more experiments. Hope this is some help.

robphoenix commented 8 years ago

I've been able to run the ember build command, after changing the name of the app in package.json file, to exercism_gui. With this change the build.js script runs successfully, creating a Setup.exe & Setup.msi, though this breaks something else as when I run the installers, they open the app and install in a default location, but the app is empty. You can find the installers in my fork

holandes22 commented 8 years ago

Thank you for taking a look at this!

electron-winstaller seems cool but I think is best to have one single library that can produce installers for all platforms (so we have less moving parts). I briefly looked at electron-builder which outputs installers for Mac/Windows and packages for most major Linux package formats. Did you have a change to check it out? (take a look at #6 for my comments on installer)

Sorry it took me quite a while to respond

robphoenix commented 8 years ago

That makes sense, I'll have a try building on windows with electron-builder, see what happens.

holandes22 commented 8 years ago

Awesome! I'll probably play with electron-builder during the weekend too, I'll keep you posted. Please send a PR if you have some progress or ping me if you need help