Electron App not Working After Packaging - Electron Forge - reactjs

So I am trying to Package my application using Electron-forge.
Tested it Locally using "electron-forge start" and it's running fine.
Also, while packaging for Linux platform [ running npm run forgeL64] the operation was successful.
"forgeL64": "npm run forge -- --platform=linux --arch=x64",
"forge": "npm run build && cross-env DEBUG='electron-forge:*' electron-forge make",
But while running the application after packaging it's not even opening the Electron Shell.
I tried all the Solutions which I can like electron-log (for which I am not seeing any Logs in the specified location of Linux Dir). Also, tried using electron-unhandled which is also not showing me any kind of error while I am executing the app.

Related

How to specify runtime directory for Vite when running the dev server

I'm trying to use Vite for a React project. I need to configure Vite so that when I run the dev server it places the runtime files in a particular directory (because the files are used with another runtime environment). The server config doesn't seems to have an option but I'm not sure if I'm missing something or it is in a different place. Thanks
It doesn't seem to be possible right now according to this repo discussion https://github.com/vitejs/vite/discussions/6108
Meanwhile, you could run the dev command along with the build --watch command to have both, but it would get slower
npm run dev & npm run build -- --watch

Tips to debug React production build code on local environment

We have a React application that is running on production. The app works perfectly fine locally but we are facing some problems in production mode. i.e., when we build the code locally for production, the issues are still reproducible.
Is there any way to debug production-built code locally?
Create production build
npm run build (build files into folder /bundle)
npm i -g http-server
and run
http-server bundler (your folder)

Configure how React app is started in production

create-react-app and npm noob here, and I'm having some trouble with deploying to production. When I start my app, I want to start a specific js file, as well as run the normal react-scripts start. So in my package.json, I have the following.
"scripts": {
"start": "node -r esm src/server.js & react-scripts start",
...
}
When I run npm start, it works great, both scripts are executed locally and up and running.
My cursory reading seems to indicate that npm start is just for development though. In production, the build/ folder will be used and... I can't figure out how it's run. Testing locally, after running npm run build, the build/ folder is made. And then running serve -s build, something is executed, but it's not my npm start script. It looks like it's just react-scripts start. Attempting to deploy to several real-life production servers like Firebase and Netlify behaves the same way.
So how exactly is the production build started? And how can I configure it to behave like my development build.
I feel like I must be misunderstanding something fundamental as I can't find any explanation online, but any help would be appreciated.
If you're interested in why exactly I have this strange setup, I'm attempting to deploy boardgame.io with a multiplayer server.
The reason to use npm start is so that you can fire up a local web server on the fly and paired with nodemon and other goodies, changes to the source can easily be viewed as if it were in production.
npm build transpiles the source into a lightweight, lazy loading bundle suitable for production. Once the build is complete, you use a web server to host build/index.html and access the site from there. What you use to host it is up to you (most commonly nginx but you could use something like apache or node like you're alluding to with serve -s build).

Builderx to expo

Is it possible to open a project made in builderx? I found that tool and it is good, but when trying to emulate it with expo it gives me many mistakes, is there anyone who uses this tool? If so, can you tell me how I can emulate the project?
You can either download the whole project and then run yarn or npm install. Or you can download the component and then use it in your existing react native project.
If you are downloading a component in which some third party components are used, you will have to add those libraries manually in your existing project by yarn add [library-name] or npm install [library-name] --save.
You can check this
Save your project in BuilderX. It will give you the Expo project.
Go to the root of the project in terminal. run the following commands.
"npm install" or "yarn"
"npm start" or "yarn start", once this command is run successfully, you'll get a QR code at the end of the output
Scan the QR code in Expo App of your mobile and It will run the project in Expo.

React production build failed to load

I have built some code with React. During its "development build", npm start at localhost:3000 give me the correct behavior.
However, after npm run build and serve -s build, the site at localhost:5000 give me this error: Can't remove headers after they are sent.
I have tried to take out everything and make it a bare bone project but the error still appears.
I have tried the production build before and this just happened.
Answer:
Nothing serious. I reinstalled serve package and it is now OK. Seems that a recent update to serve (npm i -g serve) got broken and after reinstall serve package, it is now OK.

Resources