Why does my Electron app lag after building? - electron

I have an electron app that works perfectly well when I run it with "npm start". This is my start script:
electron .
The problem for me is that when I build the program with electron-packager, it behaves abnormally and lags. My build script is below:
electron-packager . --overwrite --platform=darwin --arch=x64 --prune=true --out=
release-builds
I'm not really sure what's causing the slow behavior in my app. Additionally my app uses WebGL, so I was unable to use the "disableHardwareAcceleration()" command. I'm just confused in general as to why my app functions normally with "npm start", but then lags when I build it into an actual application.
Thank you for any help in advance!

Related

How to build Appium Desktop from source code?

I'm trying to build the "latest" version of Appium Desktop from source (on a Mac), but I'm clearly not doing something that I need to be doing, because no binary is generated after I run all the build commands.
So, I've downloaded and unpacked the .zip archive https://github.com/appium/appium-desktop/archive/v1.16.0.zip, opened up a terminal session inside the root of the source directory, and followed the online instructions for building from source--but I think this is for the server build https://appium.io/docs/en/contributing-to-appium/appium-from-source/#running-appium-from-source
npm install
npm run build
node .
And it all appears to work successfully! I get a "build completed" message and life looks fab, but nothing launches as far as an app is concerned, and I can find no .app file anywhere in the source directory. And, oddly, there are no build instructions to be found anywhere in the source directory. There's a "ReadMe.md" file but it provides no instructions on how to build from source.
Can someone please tell me what I need to do to build and launch Appium Desktop (not the server) from source? (Oh, I also ran appium-doctor and it gave me a clean bill of health.)
Any feedback would be most appreciated!
Thanks,
Wulf
You've already run npm install so it should be as simple as running npm run dev if you want it in dev mode or npm start if you want non-dev.
See the Contributing to Appium Desktop readme for more.

After packaging an electron app (installed with -no--asar) child_process.spawn not working

I know that running a bin file with spawn doesn't work when packaging an electron app with asar on a mac.
To go around that I run electron-packager with -no--asar and the app spawns processes just fine. Everything dies after running the installer?
electron-packager . --overwrite -no--asar --platform=darwin --arch=x64 --icon=./app/assets/icons/mac/1024.icns --prune=true --out=release-builds
The app runs fine, then:
electron-installer-dmg release-builds/simple-darwin-x64/simple.app/ simple-app
the child_spawn.('./bin') is dead...
I hate macs... Of course everything works on linux
Thanks!

angular 5 with electron-packager

I try to build my electron project to window app by using electron-packager but I get this error.
Failed to locate module "fsevents" from "/var/www/windowapp/electron-angular-project/node_modules/#angular-devkit/core/node_modules/chokidar"
This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager). Or your module installation failed.
Anyone know how to solve it and what happened to this?
Here my 2 cent, I did a package that works without the error, but also avoids to add unnecessary files:
electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src
The electron-packager expect that you have already run run the angular build process:
ng build --prod
You can add this script in the package.json:
"electron-package": "ng build --prod && electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src --overwrite"
Then run:
npm run electron-package
With slight modification on the answer provided by Michael Denny "electron-package": "ng build --prod && electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src --overwrite" I'm able to package my electron angular 7 application. Please note, minor modifications might require on these commands, on a case to case to basis. In my case, the following command worked.
"electron-package": "ng build --prod --base-href ./ && electron-packager . --no-prune --ignore=/e2e --ignore=/src --overwrite"
What is the change?
Removed --ignore=/node_modules
Reason: if I add this option while building, Ended up in Module Not Found Error
Added --base-href ./
Reason: Otherwise, Ended up with error Failed to load resource: net::ERR_FILE_NOT_FOUND
With these two modifications, I'm able to package my electron angular 7 application. Size of the package is close to 100MB. I'm looking for a way to reduce this size.
In the directory where your app is, try run this command
electron-packager . --no-prune
More information about this commands can be found in here https://github.com/electron-userland/electron-packager/blob/master/usage.txt
This is related to the issue #821in electron-packager with removing optional platform specific dependencies (possibly only when running packager on Windows).
--no-prune solves the problem during development, but won't work for production.
Reverting to v11.2.0 also solves the issue.

How to write an Electron app with Hyper?

I was wondering, how can I start to write an Electron app using the Hyper.js sources?
I am new to both Electron and Hyper, and watched a few videos on building an Electron app. But I can't quite figure out how to start the Hyper app. For instance, which is the "main" file in the sources?
Alright, after more reading and getting familiar with Node.js and Electron apps, the following procedure works:
git clone https://github.com/zeit/hyper
cd hyper
npm install
A lot of packages will be installed in a subdirectory called node_modules, then:
yarn run dev
And (in a separate terminal window):
yarn rup app
This will open an Electron app similar to the original one built by Hyper.

Can't require external react native Components

I'm currently trying to learn react Native. While building my first App I tryed to include a external Component from Github (https://github.com/voronianski/react-native-effects-view). Fallowing the small step by step instruction I installed the Component via npm npm install react-native-effects-view --save and included the native Code via XCode:
and required the Component via var EffectsView = require('react-native-effects-view');. After restarting the App I get the fallowing error: Error: Requiring unknown module "react-native-effects-view". If you are sure the module is there, try restarting the packager. (I did restart the package roughly 1000 times)
Maybe somebody can point out the mistake I did and explain me how to do it correct?
Thanks
Daniel
Try to run react-native run-ios. You need to run this after npm install.
you need to bundle your app again since emulator doesn't have the binary for react-native-effects-view module yet
so just run this command again
react-native run-ios

Resources