How to Fix a Javascript Error in Windows 10

Download ArticleDownload Article

If you're seeing an error that says "a JavaScript error occurred in the main process" or "a fatal JavaScript error occurred" when trying to open or install Discord, there are several potential fixes. While these fixes are designed to resolve this error on Discord, they should work to resolve similar errors in other apps, including Microsoft Teams. We'll show you how to troubleshoot JavaScript errors for Discord, Microsoft Teams, and other Windows 10 apps.

Method 1
Method 1 of 4:

Unblocking the Installer in Your Antivirus Suite

Download Article
  1. How.com.vn English: Step 1 Open your antivirus or antimalware software.
    If you're unable to install Discord or another app on your PC because of a JavaScript error, such as "a JavaScript error occurred in the main process," your antivirus software may be blocking the installer. You can fix this by adding an exclusion for the installer.
    • If you're using Windows Security, which comes for free with Windows, type security into the search bar and then click Windows Security.[1]
    • The remaining steps will cover unblocking an installer with Windows Security, but your antivirus suite may have different menu options.
  2. How.com.vn English: Step 2 Go to the Virus and threat protection area.
    This gives you a general overview of your antivirus settings.
    Advertisement
  3. How.com.vn English: Step 3 Click Manage settings.
    This opens the settings for your antivirus protection.
  4. How.com.vn English: Step 4 Add an exclusion for the Discord installer.
    If you're using Windows Security, click Add an exclusion, select File, and then open your download folder and select DiscordSetup.exe (or the name of the installer you're trying to run).[2]
  5. How.com.vn English: Step 5 Run the installer again.
    Once you've allowed the installer to run, you should resolve JavaScript errors that occur during installation.
  6. Advertisement
Method 2
Method 2 of 4:

Deleting AppData and Reinstalling

Download Article
  1. How.com.vn English: Step 1 Close Discord (or the app you're trying to fix).
    If you get a JavaScript error when trying to launch or install Discord or another app, the application data may be corrupt. If the app is running right now, you'll want to close it so you can properly delete and reinstall it. Make sure it's not minimized to your taskbar.
    • To be sure it's closed, press Control + Alt + Delete and click Task Manager. If you see a that the app is running, click to select it, and then click End Task.[3]
    • Even if you've only tried installing the app and were not successful, you should still use this method before you try to install again.
  2. How.com.vn English: Step 2 Press ⊞ Win+S.
    This activates the Windows search bar.
  3. How.com.vn English: Step 3 Type %appdata% and press ↵ Enter.
    This opens a File Explorer window to your application data.[4]
  4. How.com.vn English: Step 4 Permanently delete the folder for the app you're trying to fix.
    For example, if you're trying to fix Discord, you'll want to delete the "Discord" folder. Here's how:
    • Click the folder once to select it. Don't open the folder—just select it for now.
    • Hold down the Shift key as you press Delete.
    • Click Yes.
  5. How.com.vn English: Step 5 Press ⊞ Win+S.
    This activates the Windows search bar again.
  6. How.com.vn English: Step 6 Type %LocalAppData% and press ↵ Enter.
    This opens a File Explorer window to your local app data.[5]
  7. How.com.vn English: Step 7 Permanently delete the app's folder here as well.
    Just hold down the Shift key as you press Delete, and then confirm deletion.[6]
    • If you don't see this folder, just skip this step.
  8. How.com.vn English: Step 8 Uninstall Discord (or the app in question) from your PC.
    Here's how:
    • Open the Windows menu and click the Settings gear.
    • Go to Apps > Apps & features.
    • Select the app and click Uninstall. If you don't see the app here, just move to the next step.
    • Click Uninstall to confirm.
  9. How.com.vn English: Step 9 Reinstall the app.
    If you're reinstalling Discord, you can download the installer from https://discord.com/download. Once downloaded, double-click the installer and follow the on-screen instructions—this should fix just about all installation errors.[7]
  10. Advertisement
Method 3
Method 3 of 4:

Repairing Microsoft Visual C ++ (Microsoft Teams)

Download Article
  1. How.com.vn English: Step 1 Open your Windows Settings icon.
    If you're getting an error that says "a JavaScript error occurred in the main process" when trying to install Microsoft Teams, this may indicate a problem with the C++ libraries installed on your PC.
    • While this method is known to work for Teams, it may also resolve the same issue in other apps.
  2. How.com.vn English: Step 2 Click Apps.
    This opens the Settings panel to the Apps list.
  3. How.com.vn English: Step 3 Click Apps & Features.
    This option is in the left panel.[8]
  4. How.com.vn English: Step 4 Click the latest version of Microsoft Visual C++.
    You'll probably see several instances of Visual ++ here—you'll want to click the one that has the most recent date.
  5. How.com.vn English: Step 5 Click Change or Advanced options.
    You should see one of these two options here.
  6. How.com.vn English: Step 6 Click Repair.
    This performs a few repair steps to the C++ libraries.
    • If prompted, enter your administrator password to confirm.
  7. How.com.vn English: Step 7 Try running the installer again.
    This should resolve most JavaScript installation errors with Microsoft Teams on Windows 10.
  8. Advertisement
Method 4
Method 4 of 4:

Running the App as an Administrator

Download Article
  1. How.com.vn English: Step 1 Close Discord (or the app you're trying to fix).
    If you get a JavaScript error when trying to start Discord or another app, certain processes may be failing because they need more permissions. If the app is running right now, you'll want to close it. Make sure it's not minimized to your taskbar.
    • To be sure it's closed, press Control + Alt + Delete and click Task Manager. If you see a process for the app running, click to select it, and then click End Task.
  2. How.com.vn English: Step 2 Right-click the Discord icon on your desktop or in the Windows menu.
    A menu will expand.
  3. How.com.vn English: Step 3 Click Open file location.
    If you don't see this option, you may have to click More first. This takes you to the app's install location.
  4. How.com.vn English: Step 4 Double-click the latest version of Discord.
    If you've run a few Discord updates, you may have several folders beginning with app- and ending with a number. Double-click the one with the most recent version number.[9]
    • If you're trying to fix a different app, you'll usually see that app right here in the folder you've opened. If not, look around for a file with the app's name—it may end with ".exe."
  5. How.com.vn English: Step 5 Right-click the app and select Properties.
    Properties for the selected app will appear.
  6. How.com.vn English: Step 6 Click the Compatibility tab.
    It's at the top of the window.
  7. Step 7 Check the box next to "Run this program as an administrator."
    This gives the app permission to everything on your PC, which may clear up issues caused by access rights.[10]
  8. How.com.vn English: Step 8 Click OK.
    This saves your changes.
  9. How.com.vn English: Step 9 Start Discord or your preferred app normally.
    Now that you've set the app to run as an administrator, starting it by double-clicking its icon on your desktop or in the Windows menu will run it with elevated privileges.
  10. Advertisement

Expert Q&A

Search
Add New Question
  • Question
    Why am I getting a Javascript error with WordPress?
    How.com.vn English: Luigi Oppido
    Luigi Oppido
    Computer & Tech Specialist
    Luigi Oppido is the Owner and Operator of Pleasure Point Computers in Santa Cruz, California. Luigi has over 25 years of experience in general computer repair, data recovery, virus removal, and upgrades. He is also the host of the Computer Man Show! broadcasted on KSQD covering central California for over two years.
    How.com.vn English: Luigi Oppido
    Computer & Tech Specialist
    Expert Answer
    Check the website on other devices, like another computer or a tablet. If the same error shows up, there's an issue with the code that needs to be looked at. It also helps to make sure that Java is up-to-date on your computer, since a lot of people don't even update Java anymore (since it's updated with the operating system).
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!

      Expert Interview

      Thanks for reading our article! If you’d like to learn more about fixing javascript errors, check out our in-depth interview with Luigi Oppido.

      About This Article

      How.com.vn English: Luigi Oppido
      Written by:
      Computer & Tech Specialist
      This article was written by Luigi Oppido and by How.com.vn staff writer, Nicole Levine, MFA. Luigi Oppido is the Owner and Operator of Pleasure Point Computers in Santa Cruz, California. Luigi has over 25 years of experience in general computer repair, data recovery, virus removal, and upgrades. He is also the host of the Computer Man Show! broadcasted on KSQD covering central California for over two years. This article has been viewed 85,673 times.
      How helpful is this?
      Co-authors: 7
      Updated: April 10, 2024
      Views: 85,673
      Article SummaryX

      1.Unblock the installer in your antivirus software.
      2.Try deleting the app's folders in AppData and LocalAppData and then reinstalling.
      3.Repair the latest version of Microsoft Visual C++ in Apps & Features.
      4.Run the app as an administrator.

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 85,673 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement