electron-tutorial-app | An electron application for tutorials | Dektop Application library
kandi X-RAY | electron-tutorial-app Summary
kandi X-RAY | electron-tutorial-app Summary
An electron application for tutorials.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of electron-tutorial-app
electron-tutorial-app Key Features
electron-tutorial-app Examples and Code Snippets
Community Discussions
Trending Discussions on electron-tutorial-app
QUESTION
I have this little aplication that creates a PDF from a simple form in electron with html-pdf, it works fine when I run npm start(electron .), but after build when I try to generate the PDF I get this error:
A JavaScript error occurred in the mais process
Error: write EPIPE
at afterWriteDispatched(internal/stream_base_commons.js:156:25)
at writeGeneric (internal/stream_base_commons.js:147:3)
This is my main file "index.js"
...ANSWER
Answered 2021-May-23 at 21:19So I found a similar error in this post with the electron-pdf, that was solved changing the "electron-pdf" to a parent folder outer of node_module, something related with the "asar" that wasn't allowing any write operation. In my case what I needed to do was change my compiler method, so I first created a new project using the boilerplate,
"npm create-electron-app"
Which already have a method to build application that is "npm run make", it apparently solved the problem of permission issue to write with the html-pdf from the node_modules, working just fine after build.
QUESTION
I am writing an react-electron application and I noticed that when I used electron-builder to build it the binary was stuck when calling "spawn".
With "yarn start" the application can be executed without problems. Only with electron-builder it gets stuck.
Can you help ?
Thanks,
Update
It seems that the C++ binary included as part of the program can't be executed within electron. If I give the hardcoded full path to the binary it works but if I give the path from __dirname I get an error
...ANSWER
Answered 2021-May-17 at 09:56By default, Electron Builder compiles your application and packs all resources into one large archive file (think of it as a ZIP file) which can be read just fine because Electron brings support for this format known as "ASAR".
When running the built program, the code will be read from the archive. This means that __dirname
will point to a directory inside the archive. The operating system, however, cannot read from the archive. Since you did not actually include the piece of code calling child_process.spawn ()
, I can only speculate on why you get ENOTDIR
, which hints that a given path is not a directory when it was expected to be one, but I assume this is because you point to a path inside the ASAR file.
When relying on external binaries, it is a good idea to keep them outside the ASAR archive and programmatically find the path to them (which is quite complex) or by preventing Electron Builder from compiling your app into an ASAR file. However, you would also have to ask Electron Builder to include the executable in the built version of your app. This can be done by modifying your package.json
:
QUESTION
So, I'm working with Electron.js recently and I've packaged a few applications. Today I decided to mess around with file saving and loading and such, and I got a very solid GUI working for saving, reading, editing, and deleting text files. The way it works is by writing all its files to a /saves/
directory inside the source code, and reading from the same place. It works perfectly when run using electron .
, and so I know the issue is not with my code (so for that reason, I won't even include my code here, because I know what the issue is and I know it's not to do with my code)
The issue here is that, when I package my code using electron-packager . electron-tutorial-app --overwrite --asar --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Electron Tutorial App\"
and run the outputted .exe file, I get the following error: Error: ENOENT: no such file or directory, scandir 'saves'
When I check the packaged files, I see that my /saves/
directory is, in fact, missing. It didn't get packaged along with the rest of the application, and it is now unable to be found. If I manually create a /saves/
directory inside the folder with the .exe file, then it works perfectly fine...
So what I'm wondering is, is there a way to tell electron-packager to package the /saves/
directory along with the rest of the project? Would that require me to add a flag to my command, or perhaps change my package.json
?
Here's my package.json
:
ANSWER
Answered 2021-Jan-16 at 10:03By using the --asar
switch in your package-win
script, you're telling Electron Packager to write all your app's sources, including any directories, into an Asar archive. This is a TAR-like archive file located under resources/app.asar
in your build directory (in your case, the complete path will be release-builds//resources/app.asar
). Your app will run off of that just fine, because Electron handles loading files from the archive for you.
However, as this is an archive, you cannot simply write files to it, and it seems that you're constructing the path to your /saves/
directory yourself and not using __dirname
, which would point to the Asar archive.
That being said, one possible workaround is to either not use Asar at all (by removing the --asar
switch from your package-win
script), which will leave your app's sources pretty much unprotected from curious eyes, or by checking if the saves/
directory exists and create it if not upon app startup, which seems like the way to go.
To do so, add the following code anywhere in your main process' file, in your case main.js
(I recommend putting this code near the top):
QUESTION
In my electron app I want to package knex to use an sqlite3 database.
My package.json file
...ANSWER
Answered 2020-Nov-29 at 12:44I'm answering this question myself because I was able to package it
Firstly, I used "electron-builder": "^22.9.1"
, instead of electron-packager
.
Next, the reason it wasn't being packaged is because the storage location of my app data wasn't specified properly.
I was using sqlite database and a json file.
On windows you have make sure it gets saved under APP DATA > your foldername. Electron will handle this automatically if you use
QUESTION
FrameWork - ElectronJS
My program uses .json
files to save the user entered data. In development environment those files are written perfectly, however after packaging it with electron-packager
the JSON files are no longer written, which completely makes my program invalid.
I used mostly those JSON
files to write my program, so removing them completely will be again doing the program from scratch. Is there a way to make the program write the JSON
files in client PC as it does in dev-environment.
This is just a sample program, but all of my code is in this format.
...ANSWER
Answered 2020-Oct-01 at 11:05Yes, writing to the application location is not a good idea and often forbidden. It should be sufficient to use the appdata folder which is usually used for application settings etc.
app.getPath(name)
is the function you are looking for.
Then do something like:
QUESTION
I have the following function that is trying to load a .ejs file with the following path.
...ANSWER
Answered 2020-Sep-23 at 16:39QUESTION
ANSWER
Answered 2020-Jun-30 at 17:18Solution:
Move the "xmlbuilder": "^15.1.1" line to be inside the "dependencies"
Here is the updated package.json file
QUESTION
I have two running examples both using the same HTML page here.
...ANSWER
Answered 2020-Apr-12 at 21:55This could be an issue with getting jQuery to work with Electron. If you have Node integration turned on in your renderer process, jQuery will have issues loading because of some conflicting symbols it tries to define.
There's more information in the Electron FAQ.
The easiest way to solve this is to turn off nodeIntegration
in your BrowserWindow.
QUESTION
I have build a simple app using electron and its works fine when you launch with npm start
. After i am try to deploy my application, I am getting following error.
WARNING: --asar does not take any arguments, it only has sub-properties (see --help) Packaging app for platform win32 ia32 using electron v4.1.3 WARNING: Found 'electron' but not as a devDependency, pruning anyway rcedit.exe failed with exit code 1. Reserved header is not 0 or image type is not icon for 'a' Fatal error: Unable to set icon npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! shoppinglist@1.0.0 package-win: electron-packager . electron-tutorial-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="ShoppingList" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the shoppinglist@1.0.0 package-win script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.`
I already tried npm cache clean --force
and install node modules again by npm install
did't worked in my case. can anyone help me with this please?
package.json
...ANSWER
Answered 2019-Jun-01 at 06:39This can be happen for some reason your cache gets corrupted with some conflicting versions of different dependencies but in your case, you have already run npm cache clean
and reinstalled all the node modules.
Please check folder paths that you have given to the package.json
. This might fix your problem.
QUESTION
i have just started brushing up with electron and as a starter , i cloned this simple electron-tutorial-app to see how things work.(everything works fine with the official electron starter app).
git repo used: https://github.com/crilleengvall/electron-tutorial-app
i am not including the scripts since it is all available there.
What i have modified: edited the index.html and sections->welcome.html as shown
What is the error: the expected changes wasnt rendered in the electron app.
(note: i have not changed anything in .js or any .css files)
changes in index.html (expected changes in left panel of UI):
changes in sections->welcome.html (expected changes in main panel of UI):
Now,after i made those changes and ran the app, i get this. (see on left panel , i get "bacon" and on main panel "testing" header is rendered but the paragarph under it isnt changed.)
i am a bit confused what is happenning becuase i did some googling and thought it might be session cache issue but again, part is it is being edited and part isnt.
Any help would be appreciated.
...ANSWER
Answered 2019-Feb-21 at 13:14You need to edit strings in translations/en.js , because this is solution with localization (localization - adapting computer software to different languages).
So, if you want to change sidebar strings, you need to edit this in en.js:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install electron-tutorial-app
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page