Built electron app only prints json to screen - electron

I just wrote my first Electron app. Now I'm trying to build it through electron-packager. My package.json looks like this:
{
"name": "pixelcast",
"productName": "pixelcast",
"version": "0.0.1",
"author": "Wesley Peeters <wesley#youngones.works>",
"description": "Caster",
"license": null,
"main": "./dist/electron/main.js",
"scripts": {
"build": "node .electron-vue/build.js",
"build:darwin": "cross-env BUILD_TARGET=darwin node .electron-vue/build.js",
"build:linux": "cross-env BUILD_TARGET=linux node .electron-vue/build.js",
"build:mas": "cross-env BUILD_TARGET=mas node .electron-vue/build.js",
"build:win32": "cross-env BUILD_TARGET=win32 node .electron-vue/build.js",
"build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
"dev": "node .electron-vue/dev-runner.js",
"pack": "build --dir",
"dist": "build",
"pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
"postinstall": ""
},
"build": {
"appId": "nl.pixelservers.caster",
"win": {
"icon": "build/test.png",
"target": [
"portable"
]
}
},
}
this all works fine, but when I open the built app, this is my result:
How can I go about debugging an issue like this?
thanks.

(This might be more of a "comment" than an answer but I couldn't add the detail and image in comment)
It is hard to say without knowing how your project is structured. I use both electron-packager and electron-builder. The "dist" directory is solely for output so it is weird to me that you are referencing a script in that directory:
"main": "./dist/electron/main.js",
Given my project structure (shown below), I have "main.js" at the same level as "project.json" so:
"main": "main.js",
But maybe you have your project structured in a way which supports the way you are referencing "main.js"? . I'm using only electron-packager in the project below so no "dist" folder – I have the "release-builds" folder instead. My scripts for building look like this:
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --asar --prune=true --out=release-builds",
"package-win": "electron-packager . --overwrite --platform=win32 --arch=ia32 --asar --prune=true --out=release-builds"

Related

make electron execute itself in run version (npx electron .)

my app create another instance with some parameters:
exec(remote.process.argv[0] + " " + parameter)
In build version, it works perfect.
In dev version (npx electron .), it doesn't work.
So I need to re-build everytime.
How can I make my code work in dev version?
In dev version:
> remote.process.argv[0]
< "C:\Users\xxx\Downloads\node\editor3\node_modules\electron\dist\electron.exe"
It seems it doesn't run my app in dev version.
It just opens a default (empty) electron and put my parameter inside it without loading my app (index.html).
package.json:
{
"name": "editor",
"version": "0.1.0",
"main": "main.js",
"dependencies": {
"markd": "^1.2.0",
"marked": "^0.3.6"
},
"devDependencies": {
"electron": "^8.2.1",
"electron-packager": "^14.2.1"
},
"scripts": {
"start": "electron .",
"build": "electron-packager ."
}
}
$ npm -v
6.4.1
$ node -v
v10.15.3

electron-installer-debian compiled app .deb won't run

My compiled app don't run and i don't know why ...
electron-installer-debian -> 3.0.0
node -> 8.16.0
npm -> 6.4.1
operating system ->ubuntu 16.04.6 amd64
I can compile the example app successfully.
I can compile my app successfully.
What did i do
package.json content
{
"name": "electron-quick-start",
"version": "1.0.0",
"description": "A minimal Electron application",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-packager . electron-quick-start --platform linux --arch x64 --out dist/",
"deb64": "electron-installer-debian --src dist/electron-quick-start-linux-x64/ --dest dist/installers/ --arch amd64"
},
"repository": "https://github.com/electron/electron-quick-start",
"keywords": [
"Electron",
"quick",
"start",
"tutorial",
"demo"
],
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "^8.2.5",
"electron-installer-debian": "^3.0.0",
"electron-packager": "^14.2.1"
}
}
I compile my app successfullt by executing npm run build to build my app with electron-packager then i do npm run deb64 to compile my code.
It return a successfull sentence.
Then i find my electron-quick-start_1.0.0_amd64.deb in the dist/installers folder and install it successfully (no error of any kind).
What did you expect to happen?
I expect to run my app by searching it in the ubuntu search bar.
What actually happened?
The app juste don't run. No error pop up. Nothing ... :'(
Even if i try to run it from terminal
see the image
electron-installer-debian creates dab file which by default installs your app in usr/lib folder. If you navigate to usr/lib//resources/ give permissions to your app folder your app should work, but this is not recommended for security reasons.

Unable to deploy app on firebase using Google Cloud build ! Getting error "exec user process caused "no such file or directory"

Hi I am trying to automate task of deployment using Google Cloud build to trigger the build & deploy whenever code is pushed into master branch .
But I am getting error , in the step 2 of the build ( Deploy step )
"exec user process caused "no such file or directory"
Here are my Files :
cloudbuild.yaml
steps:
# Install node packages
- name: node:12.13.1
entrypoint: npm
args: ['install']
# Build productive files
- name: node:12.13.1
entrypoint: npm
args: [ 'run', 'build', '--prod' ]
# Deploy
- name: 'gcr.io/$PROJECT_ID/firebase'
args: ['deploy', '--project', 'dive-testing-268508', '--token', 'YYY']
Where YYY is repalced with token value ,
firebase.json
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
package.json
{
"name": "ocean-aifrontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
output path in angular.json
"outputPath": "dist",
I am unable to understand the root cause behind this !Please let me know if any further info is required for sorting this issue . Thanks
The source of this error might be due to the entrypoint for Docker in your firebase.bash file is set up for Windows, not Linux.
You may want to take a look at this issue and how it was resolved.

node modules not found after packaging electron app with electron-forge for window

Electron app was initialized using electron-forge webpack template and everything works perfectly for macOs.
While running the dev version using electron-forge start the app loads perfectly on windows.
Once the app is packaged for windows using electron-forge make the build completes successfully. But while running the packaged app Cannot find module X is thrown.
The folder ./out/app/resources/app/node_modules is empty.
Also the package.json ./out/app/resources/app/package.json looks as follows.
"name": "my-app",
"productName": "my-app",
"version": "1.0.0",
"description": "My Electron application description",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "",
"email": ""
},
"license": "MIT",
"config": {},
"dependencies": {},
"devDependencies": {},
"optionalDependencies": {},
"peerDependencies": {}
}
None of the dependencies in the source package.json made it to the packaged app.
Try this
cd "my-app"
:: install dependency into your node_modules and update your package.json
npm install your-dependency --save-prod
npm run make

Error while Packaging and Distributing Electron Desktop Apps in Windows

I have created a sample Electron App and i need to create a .exe file from it. I managed to build the app without errors but when i start the app an error appears.I cant figure out why im getting this.How to resolve this?.
The Error im getting
My package.json file
{
"name": "wordsum",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "electron main.js",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=App/assets/WSlogo.icns --prune=true --out=release-builds",
"build": "electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=App/assets/WSlogo.ico --prune=true --out=release-builds --version-string.CompanyName=DevX --version-string.FileDescription=DevX --version-string.ProductName=\"WordSum\"",
"package-linux": "electron-packager . --overwrite --platform=linux --arch=x64 --icon=App/assets/WSlogo.png --prune=true --out=release-builds"
},
"author": "Thaaraka Romesh",
"license": "MIT",
"dependencies": {
"angular": "^1.6.2",
"bootstrap": "^3.3.7",
"jquery": "^3.1.1"
},
"devDependencies": {
"electron": "^1.4.15",
"electron-packager": "^8.5.1"
}
}
The Repo of the project Electron project
I found out whats wrong. In my package.json file its mentioned as "main": "index.js" but im my app the actual main file is called main.js.

Resources