Download Article
Download 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.
How to Troubleshoot and Fix JavaScript Errors
- Check your antivirus software and create an exception for the app you’re installing.
- Delete the app data from your computer and uninstall the app before downloading it again.
- Repair the Windows Visual C++ in your system app settings.
- Try running the app as an administrator.
-
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.
- If you’re using Windows Security, which comes for free with Windows, type security into the search bar and then click Windows Security.[1]
-
This gives you a general overview of your antivirus settings.
Advertisement
-
This opens the settings for your antivirus protection.
-
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]
-
Once you’ve allowed the installer to run, you should resolve JavaScript errors that occur during installation.
Advertisement
-
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.
- 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]
-
This activates the Windows search bar.
-
This opens a File Explorer window to your application data.[4]
-
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.
-
This activates the Windows search bar again.
-
This opens a File Explorer window to your local app data.[5]
-
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.
-
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.
-
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]
Advertisement
-
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.
-
This opens the Settings panel to the Apps list.
-
This option is in the left panel.[8]
-
You’ll probably see several instances of Visual ++ here—you’ll want to click the one that has the most recent date.
-
You should see one of these two options here.
-
This performs a few repair steps to the C++ libraries.
- If prompted, enter your administrator password to confirm.
-
This should resolve most JavaScript installation errors with Microsoft Teams on Windows 10.
Advertisement
-
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.
-
A menu will expand.
-
If you don’t see this option, you may have to click More first. This takes you to the app’s install location.
-
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.»
-
Properties for the selected app will appear.
-
It’s at the top of the window.
-
This gives the app permission to everything on your PC, which may clear up issues caused by access rights.[10]
-
This saves your changes.
-
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.
Advertisement
Add New Question
-
Question
Why am I getting a Javascript error with WordPress?
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.
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
Thanks for submitting a tip for review!
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.
References
About This Article
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 121,065 times.
Is this article up to date?

Are you getting the error message “A JavaScript error occured in the main process” or similar? This happens occasionally when opening VSCode, Discord or other apps. How to fix the problem!
The error message “A JavaScript error occurred in the main process” or something similar occurs frequently under Windows 10.
A JavaScript error occured in the main process
Uncaught Exception:
Error: Cannot find module ‘…’
The problem can occur with various programmes, e.g.
- Visual Studio Code
- Discord
- Microsoft Teams
- Valorant
There are several things you can try to fix the JavaScript error. Just try your way through the list, the easiest and quickest comes at the beginning.
Method 1: Delete temporary data
This method only works for Discord. If you have the JavaScript error in another programme, jump directly to the 2nd method.
To delete the temporary data, you should first end all processes.
- Open the Task Manager (CTRL+Shift+Esc) and search for all processes of your programme and end them with a right-click.
- Then press your Windows key + R to open the “Run” window and type “%appdata%” there.
- Search for the “discord” folder there and delete it.
- Repeat the process by entering “%LocalAppData%” and delete the “Discord” folder there too.
- Now restart your PC.
- Try to open Discord.
Method 2: Repair or reinstall Microsoft Visual C++ installation
In some cases, the installation of Microsoft Visual C++ is defective. We can then repair the installation as follows:
- Download the latest Microsoft Visual C++ installer here. In most cases, the installer on the screenshot will be the right one for you:
- Open the installer and click on “Repair”.
- Restart your PC now.
- Try to open the affected programme.
Method 3: Reinstall the affected programme
Sometimes a simple reinstallation of the programme helps. As a first step, you can try to simply install it “over”. If this does not work, you can first uninstall the programme and then reinstall it.
When reinstalling, your data in Visual Studio Code and Discord will be retained (tested). For all other programs under Windows 10 and Windows 11, the data may be lost.
Download the latest installer from the website and run it:
- VSCode
- Discord
- Microsoft Teams
You can simply confirm messages like this:
This should hopefully solve the problem once and for all!
What did you think of this post?
Related Posts
This can also interest you
Each new Windows 10 update brings new issues with it. From the blue screen of death to DNS issues, we have faced so many errors. Many Windows 10 users have recently reported another uncaught exception javascript error while working with apps like Discord and Skype. You will see an error message saying a javascript error occurred in the main processes when you open these apps. It is the most frustrating issue among all other javascript errors.
Reasons for JavaScript Error
The exact cause is still a topic of research, but wrong app settings or damaged app files could be the reason. Some users have reported that they fixed the issue just by reinstalling the Discord app. So the issue could be with the wrong app installation also.
If your Windows audio-video experience service is disabled, then you can see this javascript error message, because this service is connected to that app’s core functionality of video and audio.
Whatever the reason is, this article will help you to fix this javascript error message on Windows 10.
Solution 1: End All App Processes
Try killing all app services using the task manager. When you open any app, it will start many background services related to that app. Due to these background services, you can face issues like this. So you have to identify the service which is causing the issue and kill it. In windows 10, you can force stop any app or service using the task manager utility.
Step 1: Open Run command box with Win + R and then type “taskmgr” command > press enter. This command will open the task manager.
Step 2: Find all services related to Discord and click on End Process.
Step 3: Now restart your Windows and then restart your Discord app again. This will restart all the Discord services and most probably fix the issue.
Solution 2: Delete Discord App Data
If the issue is related to the App data or damaged files, then deleting app data can fix this JavaScript issue. When you delete these files, it will reset all App settings. Many Discord users have reported that deleting the APPDATA and localappdata folder helped them to resolve the issue.
Here are the steps to delete the APPDATA folder.
Step 1: Open file explorer with Win + E key on your keyboard and then go to your OS installation drive. In my case, it is a C drive.
Step 2: Then go to Users and then open your user folder (your computer name). In my case, it is “Rahul.”
Step 3: Now, open the AppData folder. If you can’t see it, then you have to enable the “hidden items” option in the folder settings.
To enable it, click on the View tab in file explorer > enable checkbox “hidden items“. Now you can see all hidden files and folders.
Step 4: Open the AppData folder and then open the Roaming folder. Here you can see the discord folder.
You can directly go to the Roaming folder directory with this path.
C:\Users\Rahul\AppData\Roaming
Step 5: Right-click on the discord folder and delete it.
If it says “some files couldn’t have been deleted,” then it is because your app is running in the background. You have to force close it using the task manager. Open task manager from taskbar > find discord app > Right-click on it and choose End task.
Now delete the discord folder.
Now let’s delete the localappdata folder.
Step 1: Open the Run command box with Win + R key.
Step 2: Type “%localappdata%” > press enter.
Step 3: Find the discord folder here and delete it.
Now open the Discord app again and see if it is working fine or not. If you are still facing the same javascript error, then try other solutions.
Solution 3: Change the Startup Type of Windows Audio Video Experience Service
As we mentioned above, the Windows Audio Video Experience service is directly connected with the core functions of any app like Discord, Spotify, and Skype. If this service is disabled or set to manual mode, you can face issues like this. Changing the startup type from manual to automatic can resolve the error. So let’s get started.
Step 1: Open Run with the Win +R key on the keyboard.
Step 2: Type the “services.msc” command and then press enter. This command will open the services window.
Step 3: Here, find the “Quality Windows Audio Video Experience” service.
Step 4: Then right-click on it and select Properties from the list of options.
Step 5: If the service is already running, then stop it with the Stop button.
Step 6: Wait for some time and then click on the Start button again to start the service.
Step 7: Find the Startup type option and select “Automatic” from the list. Then click on Apply and OK to save the changes.
Many users have commented that they received the following error message after changing the startup type to automatic:
“Windows could not start the service on Local Computer. Error 1079…”
To fix the issue, follow these steps:
Follow the same steps as mentioned above to open Windows services.
Then click on Log On tab > click on Browse.
Enter your computer name in the “Enter the object name to select” box > click on Check Names and wait for some time. It will find and list your name here.
Click OK, and you are good to go.
Now try to open your app again. It should start without any problem.
Solution 4: Run App without Admin Permission
This kind of Javascript error is very common when you tried to run the application with administrator permission. Most of the time, JavaScript applications are opened using the Java applet file with admin privileges. To fix this kind of error, you should first close all the Javascript applications that were open with administrator privileges and then restart your computer to allow Javascript to start normally again. If you are using the Discord app with Administrator access, then you can face this issue. Many Spotify and Discord users have noticed that it works completely fine whenever they open an app without administrator rights.
Also, it is not a good practice to run any app with administrator rights. Follow these steps to remove admin rights.
Step 1: Right-click on the Discord app on your Desktop and choose properties.
Step 2: Now click on the Compatibility tab > uncheck the “Run this program as an administrator” box and click on Apply.
Step 3: Now, open the Discord app.
Solution 5: Reinstall Discord
Reinstalling the app can fix all major issues related to the app. If you face this issue with your Discord app or any other app, try to reinstall it. The majority of people have fixed the issue just by reinstalling the app. So you can try it too. Note that it will remove all app data and reset all app settings. Follow these steps to reinstall the Discord app.
Step 1: Open the start menu with the Windows button on your keyboard and then search for the control panel.
Step 2: Click on uninstall a program.
Step 3: Now, find the Discord app and right-click on it > choose Uninstall.
Uninstall a program using Windows Settings
If you are using the Windows setting app then here are the steps:
Step 1: Open Windows settings with Win + I key.
Step 2: Now click on Apps.
Step 3: Find the Discord app from the list of installed softwares and click on it.
Step 4: Click on Uninstall.
Once Discord is removed from your system, restart your PC or laptop.
Then download the latest version of the Discord app and install it.
Login to your account and check if the issue is resolved or not. The Javascript error should be fixed now.
Related Posts:
- Fix 0x80070643 Error Code in Windows 10
- Fix 0xC1900101 Error Code
- Fix Error Code 0xc0000142
Conclusion
We hope that A JavaScript error that occurred in the main process error is fixed now on your Windows 10 computer. We have shared all working solutions, which are working fine and safe.
Share your views in the command box, and feel free to ask any questions related to this topic.
Hello Everyone,
While installing Microsoft Teams, the error message described in the subject line is thrown.
Am running Microsoft Windows Version — 1909
A couple of troubleshooting tips found on https://docs.microsoft.com/en-us/MicrosoftTeams/troubleshoot-installation have been tried but the error still shows up.
Any idea on how to resolve this issue will be greatly appreciated.
UPDATES
I did a comparison of 2 SquirrelSetup.log files. (Both PC runs Windows 1909 and the same build number.
The PC 1(Throwing up the JavaScript error above)logged some issues not found in the PC 2 as shown below:
—-start—-
ApplyReleasesImpl: Couldn’t run Squirrel hook, continuing: C:\Users\Administrator\AppData\Local\Microsoft\Teams\current\Teams.exe:
System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at Squirrel.Utility.<>c__DisplayClass11_0.<InvokeProcessAsync>b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotificat ion(Task task)
at Squirrel.Utility.<InvokeProcessAsync>d__11.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotificat ion(Task task)
at
Squirrel.UpdateManager.ApplyReleasesImpl.<>c__DisplayClass18_1.<<invokePostInsta ll>b__2>d.MoveNext()
—end—-
FURTHER UPDATES
Many suggestions found on GitHub, Microsoft support site, blogs and other websites have been tried. So after spending several hours googling and searching for a working solution, the following finally worked on the PC in question.
- A standard user account was created on the PC.
- Downloaded a new Microsoft teams app.
- In services.msc, the status of a service called Quality Windows Audio Video Experience was also manually started.
- Executed the app and no JavaScript error was thrown.
N.B: I am still not satisfied with this fix, cos i applied the same troubleshooting approach on another PC throwing up the same JavaScript error, and the fix doesn’t work on it. 🙂
-
Aji_
1) Open Control Panel > Uninstall a program
2) Locate latest Microsoft Visual C++ (64bit) and click on Change (If you’re using 64 bit version of Teams, maybe you need x86)
3) Click on Repair
4) Enter your Admin credentials to perform repair
5) Once repaired Launch Teams app to make sure it works
Encountering the Windows 11 Javascript error is a common issue, particularly if you are a frequent browser user. Javascript is a programming language utilized to make web pages more interactive.
When a user visits a webpage that includes Javascript, the web browser executes the script. This means that websites can integrate programs running directly inside the browser rather than necessitating users to download and install an application on their computer.
If you encounter a Javascript error, it is likely because your browser cannot process the Javascript code, usually due to an outdated version of the software or browser.
What causes the JavaScript Error in Windows?
Various factors can cause the Windows 11 Javascript error, such as not enabling Javascript in your browser, using an outdated browser, or antivirus blocking Javascript for security reasons. Additionally, corrupted files, browser cache, or browser extensions may lead to Javascript errors.
To fix the Windows 11 Javascript error, you can try several solutions, such as enabling Javascript and Active Scripting in your browser settings, deleting temporary internet files, or checking and installing Windows updates.
Let’s have a look at these solutions in detail.
1. Enable Javascript in your browser
Disabling Javascript does not ensure complete protection from security risks, but using secure and high-performance browsers for your online activities can be a safety measure.
1. Open your browser, such as Chrome, and click on the three horizontal dots at the top right corner to open the Menu.
2. Select “Settings.”
3. Click on the “Privacy and Security” option from the left and then click on “JavaScript” option under the Content section.
4. Set the radio button to “Sites can use Javascript“.
2. Enable Active Scripting in Internet Security
1. Press the Windows + R keys simultaneously to open the Run dialog box, and type “inetcpl.cpl” to open Internet Properties.
2. Select the “Security” tab and click on “Custom level.”
3. Navigate to the “Scripting” section, click on “Enable,” and then press “OK.”
4. Click “Yes” on the pop-up window to apply the changes.
Restart your PC and check if the problem persists.
3. Delete temporary browsing files
1. Press the Windows + R keys simultaneously to open the Run dialog box, and type “inetcpl.cpl” to open Internet Properties.
2. Select the “General” tab and under “Browsing History,” click the “Delete” button.
3. Check “Temporary Internet Files,” “Cookies,” and “History” in the dialog box that pops up and press “Delete.”
Check if the problem still persists after performing this step.
4. Install Windows Updates
1. Press the Windows + I keys to open Settings.
2. Select “Windows Update” on the left pane.
3. Click on “Check for updates.”
Restart your PC once the updates finish installing.
Please note that disabling Javascript does not guarantee protection from all possible threats. Malicious Javascript can be used to hijack sensitive data or even to trick users into downloading malware or revealing personal information. Therefore, it is always advisable to use secure and high-performance browsers for all your online activities.
If you experience any issues with your browser, you may follow the expert guide on how to fix it. We hope you have found a solution to the Javascript error on your Windows 11 PC.
Also Read:
- 6 Ways to Fix CPU Fan Error on Boot in Windows
- How to Fix “Looks like you’re stranded” Xbox app Error
- Fix: 503 Valid RCPT command must precede DATA Outlook Error
- Local Security Authority is Off? How to Enable in Windows 11
- Fix TranslucentTB Not Working on Windows 11