How to Fix the ‘JavaScript Error Occurred in the Main Process’ on Discord?

When the “JavaScript Error Occurred in the Main Process” error appears in Discord, the application typically crashes or fails to open altogether. This error indicates a problem with the main process of the application, often related to a corrupted or missing file within Discord’s installation.

A JavaScript Error Occurred in the Main Process

The most common cause of this issue is corrupted Discord files, which can occur due to incomplete installations, interruptions during updates, or conflicts with other software. Other potential causes include issues with permissions, third-party modifications like BetterDiscord, and outdated system drivers.

Now that we know the reasons behind this issue, let’s follow the methods to resolve it.

1. Delete Discord Folders

Deleting the AppData and LocalAppData Discord folders can reset the application’s settings and resolve the JavaScript error preventing Discord from opening.

  1. Press the Windows Key + R simultaneously.
  2. Type %localappdata% and press Enter.
    Opening the LocalAppData folder
  3. In the directory that opens, locate and right-click the Discord folder, then select Delete.
  4. Ensure the folders are fully removed. Restart your computer and check if the error persists.

2. Change Startup Type of Service

If qWAVE (Quality Windows Audio Video Experience) is not running, it might cause errors, including the “JavaScript Error Occurred in the Main Process”. Setting it to start automatically ensures necessary dependencies for Discord are always available.

  1. Press Windows Key + R to open the Run utility, type services.msc, and click OK.
    Running the Services tool
  2. Find the Quality Windows Audio Video Experience service in the list, right-click it and choose Properties.
  3. If the service is running (check the Service status), stop it by clicking the Stop button. Then, restart it by selecting Start.
    Setting the service’s startup type to Automatic
  4. Set the Startup type in the service’s properties to Automatic. Acknowledge any prompts that appear when changing the startup type.

3. Run Discord Without Administrator Privileges

Administrative permissions can sometimes cause conflicts with system security protocols or other applications. By removing these elevated permissions, Discord operates under standard user privileges, reducing potential errors.

  1. Locate the Discord executable, right-click on its icon, and select Properties. In the Properties window, go to the Compatibility tab and uncheck Run this program as an administrator.
    Unchecking the Run this program as an administrator checkbox
  2. Accept any dialogs that appear to save your changes. Now, try launching Discord to check if the error reoccurs.

4. Reinstall Discord

By downloading and installing the latest version, the app is restored to its default state, eliminating previous bugs or glitches that interfered with its launch.

  1. Open the Start menu and open the Control Panel through search, or click the gear icon to open Settings.
  2. In Control Panel, set View as: Category at the top right corner and click Uninstall a Program under the Programs section.
    Uninstalling a program via Control Panel
  3. If using Settings, select Apps to display all installed programs on your computer.
  4. Scroll to Discord, select it, and click Uninstall.
  5. Follow the Discord uninstall wizard, choosing to completely remove Discord, and confirm with Yes.
  6. Once the uninstallation is finished, click Finish.

Reinstall Discord by downloading the latest installer from their website, executing it from the Downloads folder, and following the on-screen instructions. The JavaScript error should be resolved.

Downloading Discord

5. Close all Discord Processes

When Discord’s processes are closed through Task Manager, it ensures that no remnants from previous sessions interfere with a fresh installation or re-launch. This termination of active processes can eliminate conflicting issues.

  1. Open Task Manager by pressing Windows Key + R, typing taskmgr, and hitting Enter.
    Accessing Task Manager
  2. Locate all Discord processes, select them, and choose End Process.
  3. Attempt reinstalling and verify if it resolves the issue.

If some Discord processes cannot be ended, use Command Prompt to terminate them.

  1. Find Command Prompt through the Windows Search bar, right-click, and run as administrator.
  2. Input the following command and press Enter:
    taskkill /f /im discord.exe
  3. Check if the issue is still occurring.

6. Use Discord PTB

Discord PTB, the Public Test Build, is available on the official Discord website. Installing it allows for separate testing and resolves the conflicting issue without affecting the regular Discord installation. Download Discord PTB from here.

It is similar to the regular Discord and functions in the same way.

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.

Comments

15
    RH
    Retro Head Jun 17, 2020

    I can’t supress the folders please help

      SW
      Shane Warren Author Jun 18, 2020

      Can you please elaborate?

    MA
    mar Aug 11, 2020

    hi, i can delete the discord file when i run %appdata%, but when i run %localappdata%, it says the file or folder is open in another program. i deleted discord and unsitalled it, and i get the javascript error pop ep, and i need to delete the folder in %localappdata%, but i cant bc it says its open in another program. can someone help me?

      SW
      Shane Warren Author Aug 13, 2020

      Boot your computer in safe mode and then try to perform this step.

    MH
    Muhammad Hafiz Sep 10, 2020

    hey i do it all that, but it still cannot install discord

      MZ
      Muhammad Zubyan Author Sep 10, 2020

      Hey, Can you tell me that was there any error occurred when you were trying to delete discord data from %appdata% and %localappdata% if yes, please end any process related to discord.exe from the task manager and try again if the error still persists, please run your computer in safe mode and delete those folders also before deleting the folder open Command prompt as an administrator and type this command “gpupdate /force” without quotes. Keep me updated so I can help you fix this issue.

      Reply
    TO
    Tom Oct 10, 2020

    Hey, so I did the first solution and it utterly and absolutely did not work. To the point that my computer doesn’t even recognise Discord as being an app on my computer.So…how do I fix the things that the fix broke?

      MZ
      Muhammad Zubyan Author Oct 11, 2020

      Deleting those folders results is basically uninstalls Discord that’s why it’s not being recognized as an App on your computer. Reinstalling Discord will fix this issue. Keep me updated!

    LW
    Lawerence Welch Nov 5, 2020

    i have uninstalled discord after the first solution didnt work and now it wont let me reinstall it at all

      MZ
      Muhammad Zubyan Author Nov 5, 2020

      Is there any error or warning you are getting when you are trying to reinstall it? And have you tried installing other versions of Discord? Like Discord PTB?

    DA
    Danoontje Dec 10, 2020

    Thx, solution 5 was the best for me (easiest way too )

    MO
    MO Jan 11, 2021

    I tried everything but it still give the same error, any thing else I could try?

      MZ
      Muhammad Zubyan Author Jan 13, 2021

      You will have to completely uninstall the Discord first and then reinstall it here are the instructions:-

      1. Close Discord completely from Task Manager.
      2. Open Run and type “%AppData%/Discord” then press enter. Once the folder is opened delete it completely.
      3. Open Run again and type “%LocalAppData%/Discord” then delete this folder as well.
      4. Once the folders are deleted restart your computer.
      5. Reinstall via this link https://sudo.to/2jm

      Reply
    SW
    Swapna Feb 18, 2021

    Solution 5 finally worked. Thank you somuch Kevin

    SA
    sadegh Jan 12, 2022

    i love you . my problem easily solved