Electron package no window - electron

I run electron-packager to make a distributable from my app, but when I start the App.app, no window is shown, only the top menu.
Question: How do I best debug / troubleshoot this?
The app starts a web server and makes a tcp connection to another server. The html for the electron app is served from the local web server.
This is the output when building:
$ npx electron-packager ./ App --overwrite
Packaging app for platform darwin x64 using electron v1.8.4
Wrote new app to /Users/user/www/app/App-darwin-x64
I tried to run the node app manually in package, but got this:
$ cd App-darwin-x64/App.app/Contents/Resources/app/
$ npm start
electron not found
From package.json:
"devDependencies": {
"electron": "^1.8.4",
"electron-packager": "^12.0.1"
},
$ node -v
v8.11.1

You can't run the app like that, you need to run it without the Content/Resources/app, as thats not where its stored. You need to run it from App-darwin-x64/App.app. You also don't call npm-start, as that's only called for running in dev.
Maybe try having a look at some example electron apps with build processes, try electron-vue as that has some good examples

Related

Expo Classic/Turtle CLI standalone and offline iOS build still trying to contact development server: "Could not connect to development server"

I am using Expo Classic and Turtle CLI to make local standalone iOS builds of my React Native app.
I want my app to be “offline”: not do over the air updates, have all assets bundled with it, and generally have everything needed bundled into the simulator or binary build and not reach out to any servers to run the app.
I have been referencing the following Expo pages to create this type of build:
"Building Standalone Apps on Your CI"
"Hosting Updates on Your Servers"
"Offline Support"
My understanding from the Expo documentation is that while I need to run a local server to build my app locally, I shouldn’t need this server to be running after the build is done if I configure my app to not do over the air updates and have bundled assets. I am using the following settings in my app.json file to accomplish this:
"expo": {
"updates": {
"enabled": false,
"checkAutomatically": "ON_ERROR_RECOVERY"
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"assets/*"
]
}
The problem is that after I finish my build, kill my local server, and install/run my build in either the iOS Simulator or binary build on a device, I immediately see an error message that says “Could not connect to development server” rather than my app loading. The problem doesn’t happen if I keep my local server that I used to create the build running.
Am I misunderstanding the documentation and it is not possible to have a totally standalone build with all required files/assets bundled? Or are the app.json settings not actually working as expected?
This is how I am making my build:
From the expo project folder run: expo export --public-url http://MY.IP.ADDRESS:8000 1 --dev
dist directory is successfully created.
From the dist directory run: python -m SimpleHTTPServer 8000
From the project folder run:
EXPO_IOS_DIST_P12_PASSWORD=MY.PASSWORD
turtle build:ios
–team-id MY.TEAM.ID
–dist-p12-path …/…/Certificates.p12
–provisioning-profile-path …/…/…/Downloads/PROJECT_Ad_Hoc_Provisioning_Profile.mobileprovision
–allow-non-https-public-url
–public-url http://MY.IP.ADDRESS:8000/ios-index.json
Build binary is successfully created.
Kill server running on port 8000.
Install and run build; see error, app will not load.
Restart server on port 8000 and run build; app will load.

Rails 7.0 application with bootstrap on development mode

I have created a new rails app, after that I have installed bootstrap with cssbundling-rails,
I am now getting an error The asset "application.css" is not present in the asset pipeline. In order to have the application run I need to run the following script
"scripts": { "build:css": "sass ./app/assets/stylesheets/application.bootstrap.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules" },
Only after that there is an application file created on assets/builds path.
But I don't want to run this command every time I am updating the css files, I want the server to pick those updates without running the yarn script.
How can I achieve that?
I recently ran into an issue similar to this and the source of the problem was in fact npm and yarn.
A properly configured application using cssbundling-rails should not need to run the command
"scripts": { "build:css": "sass ./app/assets/stylesheets/application.bootstrap.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules" },
to get the application to generate the build/application.css
npm known issue
Check your npm version, there is an issue if you are not using npm 7.1+ that basically prevents yarn from setting things up correctly.
Run npm -v and if necessary, upgrade npm with npm install -g npm#latest
If you had to upgrade npm, you will then need to close out your terminal and launch a new one, verify that the npm version is greater than 7.1.
After upgrading, re run rails css:install:bootstrap
And everything should be configured correctly.
Bundle Watcher
From the documentation for cssbundling-rails
"You develop using this approach by running the bundler in watch mode in a terminal with yarn build:css --watch (and your Rails server in another, if you're not using something like puma-dev). You can also use ./bin/dev, which will start both the Rails server and the CSS build watcher (along with a JS build watcher, if you're also using jsbundling-rails)."
So, you can either run yarn build:css --watch from a separate terminal in your rails application or just use the ./bin/dev but either way should resolve the issue you are experience.

Is there a way to see in cypress electron browser some logging?

I am using cypress to test my web site. Everything works great but there is one page that opens fine when I am running the test using chrome but if I try to run that against headless or regular electron the lhes simply don’t open.
I am assuming that there must be something on my code that is not working on the chromium version that electron uses (61) that do works the version that chromes uses (75).
Is there a way to debug or check some logging on what is not being able to execute? The console for electron does not display anything.
Any ideas?
You can show console.log messages from Electron by enabling a subset of DEBUG logs.
Like so:
Windows:
npm i -g cross-env
cross-env DEBUG=cypress:server:browsers:electron cypress run...
macOS or Linux:
DEBUG=cypress:server:browsers:electron cypress run...
After adding these two env variables Cypress started showing console.log output on the terminal:
ELECTRON_ENABLE_LOGGING=true DEBUG=cypress:electron $(npm bin)/cypress run ...

Build executable for windows with Vue CLI Plugin Electron Builder in linux

I'm trying to build an executable file for windows from my linux but so far I have not been able to do it.
According to the documentation, it tells me that here I could configure, for example, the output folder.
pluginOptions: {
electronBuilder: {
outputDir: 'desktop-for-windows',
},
},
and if it works but does not say anything about how to change the platform (s.o) to build.
also try testing the following command:
npm run electron:build --win
but by default it builds for linux
Ran into same thing trying to move from an older boiler plate to using Vue-CLI 3 just now.
Run this from within the project directory and see if it works:
./node_modules/.bin/vue-cli-service electron:build --windows
I got the --windows from the ui.js file in the vue-cli-plugin-electron-builder directory under node_modules. Other options are --linux and --macos. I'm surprised I don't see a --all flag or that all isn't the default.
If you add "build:win": "vue-cli-service electron:build --windows" under scripts in your package.json then you can instead run npm run build:win from there on.
I just faced the same problem and found pretty easy answer.
You can just run npm run electron:build -- --linux deb --win nsis in the project directory.
There is more about it here: https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/recipes.html#multi-platform-build

Not able to run angular material docs on locally

Environment: Windows 7, npm 2.11.3, bower 1.4.1, gulp CLI 3.9.0
I Cloned angular material (https://github.com/angular/material/tree/v0.10.1) using WebStorm. I followed the (https://github.com/angular/material/tree/v0.10.1/docs) to install angular-material locally.
At root directory /
I run npm install it runs (with some warnings) and downloaded its dependencies (my npm -v is 2.11.3)
In run bower install but its gives following
D:\material>bower install
bower ENOENT No bower.json present
then I run gulp docs to build docs, it was build and created /dist folder at root directory. after I run the gulp server command to live reload. Its said Webserver started at http://0.0.0.0:8080 I saw on bower but no luck, also tried alternativly as http://localhost:8080 still there is no luck.
One more alternative using httpster, I installed it and run httpster -p 8080 -d ./dist/docs it said Starting HTTPster v1.0.1 on port "8080" from ./dist/docs
again i browse localhost:8080 then its gives me error in index page on developer tool of crome as below
Uncaught Error: [$injector:nomod] http://errors.angularjs.org/1.4.3/$injector/nomod?p0=material.components.menu
angular.js:4369 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=docsApp&p1=Error%3A…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.3%2Fangular.min.js%3A19%3A339)
Please help what can I do to get my luck.
Paul (ngmaterial group on google) solved my problem, However site is loading demo pages not working.
Try renaming _menu.js in material-0.10.1\src\components\menu to menu-a.js. In my case that ensured the two js files were added in the correct order.

Resources