Packaging electron app using electron-packer - folders shown not existing - electron

I am trying to package my electron app . Follwing the instruction Here. I added an object to my package.json like below
"osx-package": "node_modules/electron-packager/cli.js
./build/bin --platform=darwin --arch=x64 --version=0.34.0 --overwrite"
When i run
npm run osx-package
I received the messgage below
Packaging app for platform darwin x64 using electron v0.34.0 Wrote new
app to /...../binary-build-darwin-x64
Below is what i can see from by sublime text.
However, when i visit the folder, i can only see three files . Myapp(i.e execuatble ) , licence file and version file. I unhidden hidden files , still couldnt see my files as expected. However, the files were still shown in the directory in sublime . Clicking my app throws an error saying can't find an electron framework etc. Please what am i misssing ? How do i fix this ?

Did your try running it via the console with npm start?
After packaging the OSX app, the following files should be created:
LICENSE
LICENSES.chromium.html
MYAPP.app
version

Related

Alternative for hybrid web app without knowledge in app/server

i used to upload my ZIP (with HTML5/CSS web app) in phonegap since 4, 5 years and create cool mobile apps. But since some months it's look like Adobe dismiss the project, no more answer on forum etc.
Is there a good solution, when you don't know everything about shift/cocoa/java and server things, to simply upload your webapp (basically a website in a zip) and get IPA/APK ?
I heard about monaco or voltbuilder. Thanks
Not really. Although I can confirm https://build.phonegap.com works for me. If you have an error related to a malformed xml, you can try to delete the project on the website and re-uplading the zip file onto a new project. That's a bug I have experienced in the past.
Otherwise, you can install Cordova and Phonegap on your pc to build it using npm on the terminal (Linux/MacOs).
$ sudo npm install -g cordova
or for windows (CMD):
C:\> npm install -g cordova
then navigate with the command line using cd to go to a folder
eg. cd myfolder.
You can see the files in your current directory with ls (Linux/MacOs) or lsdir (windows)
Once you are in your project's folder and that you can see with lsdir or ls your config.xml file of your project, then you can run those commands to add the platform you want to build:
cordova platform add ios
cordova platform add android
Finally to build the app, you need to:
cordova build
Note: To build an Ipa, you will need to use a device running MacOs since it requires XCode. I highly recommand you to get familiar with Cmd or the terminal if you are building an app.
I hope I have answered your question well

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.

Electron executable not recognized by Nautilus

I'm not able to build an executable file of an Electron App with the following command:
electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=release-builds
The build file, which is a shared library file (application/x-sharedlib), is not executing on Ubuntu 18. Instead, I'm getting the following error message when opening the file in Nautilus:
Could not display "electron-tutorial-app"
There is no application installed for "shared library" files. Do you
want to search for an application to open this file?
[No] [Yes]
Is there any way around to do this?
TL;DR: the produced files are actually executables of a new format. There's nothing wrong with them. Nautilus/file managers mistakenly don't recognize them as executables. There are solutions, such as creating a *.desktop file to launch the application.
Analysis
This phenomenon occurs as a side-effect of a change in how Electron builds Linux binaries. The commit 9294facf changed the binary format from ELF to PIE. The change is quite small and only affects a single file (BUILD.gn). The change has landed in Electron starting with version 4.0.0.
File managers utilize the file command to decide what to do with a file (e.g. open an image viewer, a text editor or execute the file). file cannot distinguish between shared libraries and PIE executables and therefore misclassifies PIE files (see the corresponding bug report).
Solutions
Run from terminal
Since the problem only exists for graphical file managers, you can simply run the executable from the terminal or from a script. This is somewhat involved for non-technical end users and not what the OP wants.
Wait for upstream fix
Wait for file to recognize PIE as executable files. In turn, this will likely lead to file managers such as Nautilus to launch the PIEs correctly. It's not clear if or when this will happen. If it happens, it will likely only be included in future distro releases.
Use a desktop file
Create a desktop file to launch the application. This is a common way desktop applications are launched anyway.
Create a file called myapp.desktop with the following contents.
[Desktop Entry]
Name=My Application
Exec=/path/to/binary
Terminal=false
Type=Application
StartupNotify=true
Encoding=UTF-8
Then, mark the desktop file executable by issuing chmod +x myapp.desktop. Double clicking the file should launch the application as expected.
Further information
The corresponding discussion in the electron-packager project: https://github.com/electron-userland/electron-packager/issues/901. (Gist: This issue was not caused by electron-packager, look upstream)
The corresponding issue in the electron project is https://github.com/electron/electron/issues/15406. (Gist: they wanted to enable PIE on Linux. Not our bug, look upstream)
For Linux(Ubuntu):
Downgrade Electron package:
npm install electron#3.1.6 --save-dev
For global (If needed)
npm install -g electron#3.1.6
Execute electron-packager command - for linux:
electron-packager . electron-tutorial-app --overwrite --asar --platform=linux --arch=all --prune=true --out=release-builds
This will result in 4 Linux folders(arch=all). Select a working executable according to your OS.
This is an issue when electron-packager is used to package a Linux app with Electron version 4.0.x, whereas there was no problem with previous Electron versions, such as 3.1.x.
For some reason, in Electron 4.0.x, the produced app file is a shared library instead of an executable.
From a Terminal window, running the file command on the app file path gives:
ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0,
BuildID[sha1]=b9e8ba37118dad1bf605affef41026f813215bc6, stripped
while it used to be:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,
stripped
Fortunately, it is still possible, albeit cumbersome, to run the app by launching it from a Terminal window, for instance by dragging the app file icon onto the terminal prompt, then typing Enter.

Hide source code from build executable in electron-app

I am trying to package and distribute my app which is written in electron. I noticed that when the binaries build is completed, the local resource/source code are also exposed in the final built folder.
In the resource/app folder, you would have all your source code revealed to anyone who can access.
I am wondering if there's anyway to hide these information, and just deliver the built binary.
I am using Electron 1.2 and electron-packager 7.0.4
Beyond mini-/uglifying your js code (can still be viewed) and creating an .asar package (can be extracted) there is not a whole lot you can do to prevent the visibility of your code.
See also this post on the electron-packager github page:
theres nothing built in to electron to do that, so we don't support
anything like that (since we only support what electron supports). you
would have to implement that in your own module and run it on your
code before using electron-packager -maxogden
If 7 years have passed but are still looking for an answer, they can use #electron/asar. When creating an application with electron packager, it creates a file with an .asar extension that will store your code if you type "--asar" on the terminal screen. For example;
electron-packager . {your exe file name} --overwrite --asar --platform=win32 --arch=x64 --icon={your icon file source} --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="product name"

ionic build ios fails with "[TypeError: Arguments to path.join must be strings]"

I am trying to create an ionic app on Mac.
I followed the instructions on ionic's website to create a basic app and was able to run it in the browser but when I run "ionic build ios" I get following error. I cannot find a log file or any other error to debug this. How do I go about fixing this?
Check your Gulp version and gulpfile.js. You may need to remove the calls to gulp.src
See:
Gulp TypeError: Arguments to path.join must be strings
and
https://github.com/sindresorhus/gulp-ruby-sass/issues/191
ok, after lot of looking and searching I figured my npm install was messed up.
Part of my installs were in /usr/local and few of them were in /User/user.name/npm folders. /Users/user.name/npm was set in the npm config prefix.
I had two installs of cordova, one on each folder above. Some how the cordova from /usr/local was getting used to create the project and that was the old version.
To fix the problem, I uninstalled all my global npm installs and pointed my npm config prefix to /usr/local and gave myself execute permission on that folder. Everything is working now.
Here is the video that explains how to do it: https://docs.npmjs.com/getting-started/fixing-npm-permissions

Resources