will-stone / SpotSpot

A Spotify mini-player for macOS
https://spotspot.wstone.uk
MIT License
135 stars 20 forks source link

How to compile/package without errors? #26

Open briantully opened 5 years ago

briantully commented 5 years ago

Hey there Will!

Long time no speak. I hope all is well.

I was wondering if you might have an idea why I am seeing the following error when I try to run yarn make or yarn package?

✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
⠸ Compiling ApplicationFailed to compile file: /var/folders/7t/2f8l2q9n289gp4hwwbb8622m0000gn/T/electron-packager/darwin-x64/SpotSpot-darwin-x64/Electron.app/Contents/Resources/app/src/types/global.d.ts
Debug Failure. False expression: Output generation failed
⠼ Compiling ApplicationFailed to compile file: /var/folders/7t/2f8l2q9n289gp4hwwbb8622m0000gn/T/electron-packager/darwin-x64/SpotSpot-darwin-x64/Electron.app/Contents/Resources/app/src/types/spotify-node-applescript.d.ts
Debug Failure. False expression: Output generation failed
yildiz commented 5 years ago

Hey! I ran "yarn package" command in macOS Terminal and it worked fine for me.

will-stone commented 5 years ago

Hi. Have you updated Node recently? Try deleting the node_modules folder and rerunning yarn.

briantully commented 5 years ago

Actually yes, I did upgrade node from 8.x to current (11.13.0) last week. I'm guessing there is an incompatibility with current in one of the dependencies. I'm going to try to downgrade node to LTS (10.x) and see if that is any better.

briantully commented 5 years ago

No luck. Even after downgrading node to 10.15.3 and removing node_modules and doing a clean install by running yarn, yarn package still gives the error where it cannot transpile/compile the global.d.ts and spotify-node-applescript.d.ts files.

yarn package
yarn run v1.15.2
warning ../../package.json: No license field
$ electron-forge package --platform=darwin --arch=x64
✔ Checking your system
✔ Preparing to Package Application for arch: x64
⠙ Compiling ApplicationFailed to compile file: /var/folders/7t/2f8l2q9n289gp4hwwbb8622m0000gn/T/electron-packager/darwin-x64/SpotSpot-darwin-x64/Electron.app/Contents/Resources/app/src/types/global.d.ts
Debug Failure. False expression: Output generation failed
⠹ Compiling ApplicationFailed to compile file: /var/folders/7t/2f8l2q9n289gp4hwwbb8622m0000gn/T/electron-packager/darwin-x64/SpotSpot-darwin-x64/Electron.app/Contents/Resources/app/src/types/spotify-node-applescript.d.ts
Debug Failure. False expression: Output generation failed
✔ Compiling Application
✔ Preparing native dependencies
✔ Packaging Application
✨  Done in 278.58s.

FYI I'm running Mojave 10.14.4 with the latest Xcode and Xcode CLI tools.

briantully commented 5 years ago

Interestingly, yarn start serves the app successfully, so it's just the package/compile process that is failing.

¯\_(ツ)_/¯

will-stone commented 5 years ago

I think this was down to a corrupt yarn.lock file. @briantully Please pull master and try again.

briantully commented 5 years ago

Thanks, @will-stone. I tried that, and am able to get a little further during the app compilation. However, now I see the following error:

Packaging ApplicationWARNING: Code sign failed; please retry manually. Error: No identity found for signing.

Is there some special configuration I need to set?

yarn package
yarn run v1.16.0
warning ../../package.json: No license field
$ electron-forge package --platform=darwin --arch=x64
✔ Checking your system
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
✔ Preparing native dependencies
⠹ Packaging ApplicationWARNING: Code sign failed; please retry manually. Error: No identity found for signing.
✔ Packaging Application
✨  Done in 45.48s.

When launching the packaged output:

A JavaScript error occurred in the main process

Uncaught Exception:
Error: Could not get code signature for running application
    at initUpdater (/Users/brian.tully/Sites/SpotSpot/out/SpotSpot-darwin-x64/SpotSpot.app/Contents/Resources/app/node_modules/update-electron-app/index.js:54:15)
    at App.opts.electron.app.isReady.opts.electron.app.on (/Users/brian.tully/Sites/SpotSpot/out/SpotSpot-darwin-x64/SpotSpot.app/Contents/Resources/app/node_modules/update-electron-app/index.js:33:43)
    at App.emit (events.js:187:15)
will-stone commented 5 years ago

You will either need an Apple Developer Account to sign the app or remove this line: https://github.com/will-stone/SpotSpot/blob/master/package.json#L86

briantully commented 5 years ago

Thank you! And thanks for saving me $99 😜

briantully commented 5 years ago

Hmm,I'm still having the same error when launching the packaged output. After removing the line at https://github.com/will-stone/SpotSpot/blob/master/package.json#L86 do I also need to delete my yarn.lock and node_modules directory and do a yarn install?

will-stone commented 5 years ago

You shouldn't have to. That osxSign key is the only thing that tells Electron Packager to sign the app. It looks like it's still packaging the app. Does the built one not run?

briantully commented 5 years ago

yarn start works, but yarn package does not, even after deleting yarn.lock and node_modules and doing a yarn install.