kiwix / kiwix-js-pwa

Kiwix JS Offline Browser implemented as a Progressive Web App (PWA), and packaged as Electron, NWJS and UWP apps for Windows and Linux.
https://pwa.kiwix.org
GNU General Public License v3.0
168 stars 26 forks source link

Uncaught Exception EARDDRINUSE address already in use 3000 #617

Closed BridgetteMurray closed 4 weeks ago

BridgetteMurray commented 1 month ago

Hi All, I've got this error and looking for some help please, thanks

image

Jaifroid commented 1 month ago

Hi @BridgetteMurray, it looks like you have some other app that is using port 3000. You can change the port number of the Electron app in configuration, if you can get to the setting. To get to the setting you may need to shut down any other application using port 3000 first (or it could be a duplicate copy of the same app that has got stuck and is hogging the port). A reboot should work, and then it ought to be possible to open the app and change the port number. I would use a number higher than 3010 (it doesn't really matter what, but 3001 and 3002 are reserved for WikiMed and Wikivoyage apps).

Jaifroid commented 1 month ago

PS The setting is under "Troubleshooting and Development" in Configuration. You can also find out if anything is hogging the port by opening Terminal / PowerShell and typing:

netstat -ano | findstr :3000

If nothing is shown, then the port has successfully been cleared. If it shows a line or two with LISTENING, then the port is indeed in use. If it's constantly in use by another app, and you can't determine what it is, you can kill the task (temporarily) using:

tskill typeyourPIDhere (PID is the number to the far right after LISTENING given in output of previous netstat command).

Jaifroid commented 1 month ago

619 Automatically fixes this issue on startup (if port is in use, it increments the port by 10 until a free port is found, and stores that value). However, this version won't be available as an update until the next release, so the workarounds suggested above would need to be used until there is a new release later this month.

BridgetteMurray commented 1 month ago

Thanks all, I've identified what is causing the problem, I had an idea but your comments pointed me directly to it, Grafana sits on port 3000, the last couple years I've been doing a lot of assignments with Harvard uni and I'm pretty sure it got loaded to do something with Harvard but I cant remember what. I'm loading Kiwix via Microsoft store which is where the error that I screen shot above comes from, I've used my task manager to end the Grafana service several times but it just pops backup as a different PID still on port 3000, I really don't want to uninstall it just in case something I've worked on that is relying on it. Is there a way I can open Kiwix JS from the Installer application on my HDD, which takes me to the Microsoft store, can I use a command to open on a different Port ?, or do I have to wait for the next version?, thanks

Jaifroid commented 1 month ago

@BridgetteMurray Since we now have a nightly version of the app which has the new code in it, we can use that to update the port. According to my experiments, installing and running this will also update the port for your installed Store version, meaning you can then uninstall the nightly after it's done that job. You don't need to uninstall the Store version while doing this. Here's the procedure:

  1. Download the following nightly file: https://download.kiwix.org/nightly/2024-06-17/kiwix-js-electron_win7_setup_2024-06-17.exe (just Save to downloads or to desktop, wherever is easy to find)
  2. Run the downloaded file installer (ignore the fact that it says Win7 in filename, this is just a universally compatible version for all Windows 7/8/10/11). You can install it "just for you", and you can let it launch after install if you like
  3. If this didn't launch after install, go ahead and launch it. It is called "Kiwix JS Electron" and has a purple icon as opposed to the black icon of the Store app
  4. This should launch correctly and in Configuration you should see that it is using port 3010 (or another port other than 3000)
  5. Close this version, then open the Store version (black icon). It should open correctly and be running on port 3010 as well. Fingers crossed.
  6. If it worked, then exit both apps, and you can uninstall the purple one from Add and Remove Programmes.

If it didn't work, try launching the purple app once again and double-check the set port. Then exit and open the Store version. If still not working, then you can use the purple-iconed app until a new full update is issued to the Store, at which point your Store version should atuo-update.

BridgetteMurray commented 1 month ago

@Jaifroid... brilliant, I'm in, now to learn to drive it, thankyou so very much for your assistance.

Jaifroid commented 1 month ago

Great, I'm glad it's resolved with that workaround. You can either download archives in the app (Open Library in Configuration), which will give a download library based on the filenames, or you can use https://library.kiwix.org in a browser (a more visual interface). It's best to place your downloaded archives in a single folder, because then it makes it easy to switch between archives if you use the Select Folder option (after clicking Select Storage button) in Config.

I'll leave this thread open until a new version is in the Store, in case anyone else is running into difficulties with this.

Jaifroid commented 4 weeks ago

Just to let people here know that the latest version of the app with this fix has now been published both in the Microsoft Store and in releases. So I'm now closing this issue as fixed. Many thanks!