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

The JavaScript error occurred in the main process appears when you try to launch Discord on your computer. The error message window typically contains various pieces of information regarding the error, which can be challenging to interpret for casual users.

A JavaScript Error Occurred in the Main Process

Many different methods have been used to resolve this problem. These methods are usually straightforward enough to perform without wasting time. Ensure you follow the instructions carefully, and the issue should be resolved quickly.

Solution 1: Delete Discord Folders

Deleting both the AppData and LocalAppData Discord folders should reset the app’s settings and resolve the JavaScript error that prevents you from opening Discord. Although originally suggested for a different issue on the Discord website, users have reported that this solution also resolves the error discussed here.

  1. Navigate to the following location using Windows Explorer:
    C:\Users\YOURUSERNAME\AppData\Discord
  2. If you cannot see the AppData folder, you may need to enable the viewing of hidden files and folders. Click on the “View” tab in File Explorer’s menu and click on the “Hidden items checkbox in the Show/hide section. File Explorer will then display hidden files and remember this option until you change it again.
    Viewing the hidden AppData folder
  3. Delete the Discord folder within the AppData directory. If you receive a message stating that some files could not be deleted because they are in use, try closing Discord or ending its process in Task Manager.
  4. Use the Start button or the search button next to it and type “Run,” or press the Windows Key + R to bring up the Run dialog box. Type “%localappdata%” and press Enter.
    Opening the LocalAppData folder
  5. Find the Discord folder in the opened directory, right-click on it, and select Delete.
  6. Ensure the folders are completely removed with no remaining files. Restart your computer and check to see if the Discord error still appears.

Solution 2: Change Startup Type of Service

Changing the startup type of the Quality Windows Audio Video Experience service from Manual to Automatic has resolved the JavaScript error for many users. This solution has also resolved similar errors for other applications besides Discord.

  1. Use the Windows Key + R to open the Run utility, type “services.msc,” and click OK to open the Services tool.
    Running the Services tool
  2. Locate the Quality Windows Audio Video Experience service on the list, right-click on it, and select Properties from the context menu that appears.
  3. If the service is started (this can be verified next to the Service status), you should stop it by clicking the Stop button in the middle of the window. Then, restart it by clicking Start.
    Setting the Quality Windows Audio Video Experience service’s startup type to Automatic
  4. Ensure the Startup type option in the service’s properties window is set to Automatic. Confirm any dialog boxes that may appear when changing the startup type.

You may receive the following error message when clicking on Start:

"Windows could not start the service on the Local Computer. Error 1079: The account specified for this service differs from the account specified for other services running in the same process."

If this occurs, follow the instructions below to fix it:

  1. Revisit steps 1-3 above to open the service’s properties window. Go to the Log On tab and click on the Browse… button.
  2. Under the “Enter the object name to select” box, type your account’s name, click Check Names, and wait for the name to resolve.
  3. Click OK when done, and enter the password in the Password box when prompted if you have established a password. The service should now start without issues.

Solution 3: Run Discord without Administrator Privileges

Some users have observed that the app works when they are not logged in using their administrator account. This suggests that the root issue might be related to administrator permissions.

Running programs with administrator privileges when unnecessary can lead to security risks, and various users have reported success in resolving the problem by running Discord without admin permissions.

  1. Find the Discord executable, right-click on its icon (whether on the Desktop, the Start menu, or the Search results), and select Properties. Navigate to the Compatibility tab in the Properties window and deselect the box next to Run this program as an administrator before saving the changes.
    Unchecking the Run this program as an administrator checkbox
  2. Confirm any dialogs that appear to verify your changes. Discord should now launch without admin privileges. Try opening it by double-clicking its icon and check if the error persists.

Solution 4: Reinstall Discord

Reinstalling the app is a common but crucial method, as it has worked for many users experiencing this problem. Although this solution is quite generic, it’s important to perform each step correctly for a fresh and functioning installation of Discord.

  1. Ensure you are logged in with an administrator account as standard accounts cannot delete programs.
  2. Click on the Start menu and open Control Panel by searching for it, or click on the gear icon to open Settings.
  3. In the Control Panel, select View as: Category at the top right and click on Uninstall a Program under the Programs section.
    Uninstalling a program in Control Panel
  4. If using the Settings app, clicking on Apps should automatically open a list of all installed programs on your PC.
  5. Find Discord in the list in Control Panel or Settings and click on Uninstall.
  6. The Discord uninstall wizard will prompt you with a choice to “completely remove Discord on your computer.” Choose Yes.
  7. Click Finish when the uninstallation process is complete.

After successfully uninstalling Discord, reinstall it by downloading the latest installer from their website, running it from the Downloads folder, and following the on-screen instructions until the process is finished. The JavaScript error should no longer appear.

Downloading Discord

Solution 5: Close all Discord Processes

We will attempt to end all Discord processes from Task Manager and reinstall the app. Discord is known to encounter installation issues if there are concurrent processes running beforehand. The solution is to terminate all Discord processes via Task Manager.

  1. Press Windows + R, type “taskmgr” in the dialogue box, and press Enter.
    Accessing Task Manager
  2. In Task Manager, search for all Discord processes, select them, and click End Process.
  3. Now try reinstalling and see if this fixed the issue.

If you are unable to terminate some Discord instances, you can use the Command Prompt to get rid of them.

  1. Click on the Windows Search bar, type “Command Prompt,” right-click on it, and run as administrator.
  2. Type the following command and press Enter:
    taskkill /f /im discord.exe
  3. Now check to see if the issue persists.

Solution 6: Use Discord PTB

Discord PTB is Discord’s Public Test Build, which you can download from the official Discord website. It will install alongside the standard version of Discord and function independently with its own data, without interfering with your normal Discord installation. Download Discord PTB (here).

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.