Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Build process on Windows produces an electron app that crashes on startup #108

Open
tigrannajaryan opened this issue Oct 8, 2017 · 9 comments

Comments

@tigrannajaryan
Copy link

After following step-by-step the contributing instructions for Windows I can see packages\client-app\dist\NylasMailSetup.exe. Running this program as expected installs Nylas Mail, however at the end of the installation process it attempts to launch Nylas Mail which immediately crashes.

Trying to launch C:\Users\<username>\AppData\Local\NylasMail\nylas.exe after the installation is finished crashes in a similar way.

Nylas-Mail-14308.log file contains the following error message:

Error: Cannot find module 'isomorphic-core'\n at Module._resolveFilename (module.js:455:15)

Full log file is attached.

Trying to launch packages\client-app\dist\nylas-win32-x64\nylas.exe produces the same error message.

It seems that isomorphic-core is not included in the electron package although it is present in the package.json dependencies.

Running npm start correctly runs Nylas Mail which works fine, so the problem is most likely in the electron packaging steps.

The error is reproducible every time from a clean clone of https://github.com/nylas-mail-lives/nylas-mail repo.

[Environment]
Windows 10 Pro, Version 1703
node v6.9.0
npm 5.5.1
Microsoft Visual Studio 2013, Update 5, Community Edition

[Steps to Reproduce]
git clone git@github.com:nylas-mail-lives/nylas-mail.git
cd nylas-mail
set NODE_VERSION=6.9
set DEBUG=electron-windows-installer:,electron-packager:
set SIGN_BUILD=false
set INSTALL_TARGET=client
set npm_config_arch=x64
set npm_config_target_arch=x64
set npm_config_msvs_version=2013
npm config set arch x64
npm config set target_arch x64
npm config set msvs_version 2013
npm install
npm run build-client
node packages\client-app\build\create-signed-windows-installer.js
packages\client-app\dist\NylasMailSetup.exe

@mikeseese
Copy link
Contributor

Thanks for the detailed issue! It seems like you're doing everything I do when I make the builds. Windows is definitely the most difficult OS to build Nylas.

Let me look at this log later and see if I can figure out what's going wrong. The isomorphic-core should be built during npm-install

@mikeseese
Copy link
Contributor

I'm assuming you're using a 64 bit OS? Could you upload a log of your npm install and npm run build-client?

@tigrannajaryan
Copy link
Author

Yes, I am using Windows 10 Pro 64 bit. I will get the logs, in the meantime here is some additional information.

I can confirm that the problem is indeed because isomorphic-core is missing in the electron package. I did asar l packages\client-app\dist\nylas-win32-x64\resources\app.asar and there is no node_modules\isomorphic-core listed.

I also double-checked this by setting “asar: false” in packages\client-app\build\tasks\package-task.js and rebuilding. The resulting dist\nylas-win32-x64\resources\app\node_modules directory does not contain isomorphic-core. Furthermore, if after the build finishes I manually copy packages\client-app\node_modules\isomorphic-core to packages\client-app\dist\nylas-win32-x64\resources\app\node_modules everything starts working perfectly.

So for some reason the electron-packager misses isomorphic-core module and does not add it to the package.

@tigrannajaryan
Copy link
Author

I narrowed it down a bit more. The problem seems to be at the pruning steps of electron-packager. If I set 'prune': false on line 233 of packages\client-app\build\tasks\package-task.j the problem goes away, everything starts working perfectly.

So, for some reason isomorphic-core gets pruned when it shouldn't. Looking at electron-packager source code I can see that 'prune': true results in calling npm prune --production so this may be a npm bug.

@seesemichaelj can you please tell what npm version you use on Windows? I have 5.5.1.

@mikeseese
Copy link
Contributor

mikeseese commented Oct 10, 2017

I'm using version 3.10.10.

Have you verified you don't have any Lerna issues before npm install? This is Step 4 under Common in https://github.com/nylas-mail-lives/nylas-mail/blob/master/docs/guide/contributing/installation.md

@tigrannajaryan
Copy link
Author

package.json files are not changed. Is there anything else I can check about Lerna?

@mikeseese
Copy link
Contributor

I'm really not sure until I can see complete build output files at this point

@tigrannajaryan
Copy link
Author

I will try to get another Windows system and try there. Thanks for the help.

@mikeseese
Copy link
Contributor

every time i have an issue with the isomorphic-core not getting compiled in, it's because lerna changes the package.json file for the isomorphic-core and gets a eperm: operation not permitted error when renaming package.json.lerna_backup -> package.json. related issues: npm/npm#9696 and npm/npm#12059. i was having issues even though 9696 said it was working in npm3 (i have v3.10.10). but npm/npm#12059 (comment) mentions something about disabling mcafee (which makes sense as issue 9696 mentions something about file io issues). i disabled windows defender real time this time building and was able to prevent the error from happening

hopefully this may help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants