A javascript error occurred in the main process: what to do?

If you see a failure warning on your monitor, it means your Discord voice chat has stopped working due to the error “JavaScript error occurred in the main process”. This is one of the many errors in the Windows operating system. It is used to indicate a failure in a specific area or program. Many errors can be corrected with simple step-by-step steps. But some can’t be fixed on your own; you need to seek qualified help from a specialist. Below we will look at how to fix the Javascript error occurs error.

What does it mean?

Naturally, you first need to understand what exactly this error means. To do this, we will use any online translator to translate the phrase into Russian. What happened was: A JavaScript error occurred in the main process.

Now you can move on to finding a solution. Let's look separately at situations where the message “A javascript error occurred in the main process” appears when starting Discord and Skype.

Error object

Error object instances have several properties that we can use. The first property we are interested in is message. This is where the string that can be passed to the error constructor as an argument ends up. For example, below shows the creation of an instance of the Error object and the output to the console of the string passed by the constructor by accessing its message property.

The second property of the object, which is very important, is the error stack trace. This is the stack property. By accessing it, you can view the call stack (error history), which shows the sequence of operations that led to the incorrect operation of the program. In particular, this allows you to understand which file contains the faulty code, and see what sequence of function calls led to the error. Here's an example of what you can see by accessing the stack property.

Here, at the top, there is an error message, followed by an indication of the section of code whose execution caused the error, then a description of the place from which this faulty section was called. This continues until the piece of code furthest away from the error.

Correction method for Discord

In this case, there are a number of universal recommendations that should definitely be put into practice:

Program update

Yes, sometimes the status A javascript error occurred in the main process occurs precisely because this product requires an update, but the required process, for some reason, is not activated automatically. If this is so, then the user will have to do everything himself:

  • Exit the program, go to the task manager, view the list of running processes, disable those that are guaranteed to be associated with Discord;

  • On the keyboard, simultaneously hold down the “Win” and “R” buttons. The “Run” line will open. Use the %AppData% command in it. And don’t forget to click on OK or Enter to confirm;

  • In the directory tree that opens in this way, you must first return from the “Roaming” folder to “AppData”. Then open the “Local” folder, and in it – the folder with the same name of our program;

  • Among the files you can find “update.exe”. Launch it.

Now you can safely close everything open. Return to the Discord icon. Click on it to start the program. If everything is done correctly, then at this moment the software will begin to perform its update. You need to be patient, wait for the running process to complete, and check the result.

Reinstallation

Didn't the previous option help? Let's move on to the next one. It involves uninstalling the program and installing the current version again. Regular deactivation will not help in this situation. Yes, in this way the user can remove some components, but the remains of the program will still be on the hard drive. And they are the ones who can lead to a recurrence of the problem. Therefore you need to act like this:

  • Naturally, close the program window completely. That is, we get out of it;
  • We launch the task manager again and, just like in the previous situation, gets rid of all programs whose name contains the word “Discord”;
  • Now you need to go to “Programs and Features” through the “Control Panel”;
  • We look through the list and find the product we need. Select it and click on the button to remove the software;
  • Press “VIN” and “R” again. We enter the same command: %AppData%. We confirm it;
  • We make the transition: from Roaming to AppData, then to Local;
  • Find the folder with the name of the program and delete it.

All that remains is to go online. Preferably, to the official website of the developers. Download the installer, run it, and carry out the installation according to the instructions.

What else can you try?

In nine cases out of ten, the methods described above do an excellent job of solving the problem. But there are cases when they don’t help either. What is recommended to try in such situations:

  • Launch a good, up-to-date antivirus program. Diagnose the system and treat it if antivirus software detects any infections. If possible, for greater efficiency, it is advisable to run several antivirus programs sequentially;
  • If the problem began to occur after installing some other program, then you should think about the fact that they are simply incompatible with each other. And uninstalling recently installed software often leads to the discovery of a necessary and effective solution.


SUPERAntiSpyware
Another not-so-pleasant point is that this problem is less common on relatively new operating systems. But on OSs whose support has already been completed by Microsoft, more often. Therefore, if none of the described methods helped get rid of the error, you can only do the following:

  • Completely stop using this program. And try to find an alternative to it;
  • Switch to a more modern operating system. And this is, at a minimum, Windows version eight and higher.

Simple examples of error detection

The console supports many options, but you can get by with 3-4, this is enough to identify and further correct the error. From my own experience, the log() is the most convenient. It outputs new messages, DOM elements, variables to the console where we can see them. The examples below show the applications of the functions I use.

In this script, the console displays different results depending on the value of the full_name variable (empty or not).

if (full_name != ""){ console.log('The name \"' + full_name + '\" was entered'); }else{ console.error('No name was entered'); }

For a jQuery click event, the console will print information about the element being clicked (trace):

$('.trace').click(function(){ //Start tracing on onclick event console.trace(); return false; });

The console is more than just outputting messages; it can also accept commands. For example, type "document" and press Enter to get information about the page.

We fix it for Skype

Yes, unfortunately the more famous product known as Skype also faces a similar problem. What is proposed to be done:

  1. First of all, install the Skype update to the most current version. And the program sends many users notifications about the need for an upgrade. And, if the settings are set correctly, the next time you start Skype automatically starts the procedure. But for some people, for some reason, this does not happen. And their version is becoming outdated. It needs to be updated manually: go to the official website of the developers, download the current version (naturally, suitable for the system you are using and its bit depth), install the downloaded package.

  2. The next step is to check the version of the Microsoft proprietary browser – Internet Explorer. And updating it to the eleventh version.

Procedure for updating IE to version 11

So, initially we find out the current version of this Internet browser:

  • Launch the browser itself;
  • In the upper right corner we use the button in the form of a gear;
  • The drop-down menu is activated;
  • In it you need to select the “About Internet Explorer” item. Click it and get the required information.

In general, this program itself should be updated automatically. If this does not happen, it is recommended to do the following:

  • Click on the “Start” button at the bottom of the desktop;
  • Go through “Settings” and “Update and Security” to the so-called Windows Update Center;
  • Click on the “check for updates” prompt.

Wait for the running process to complete. If the system detects something, perform the installation.

As an alternative, you can immediately download the eleventh version of this web browser from the official Microsoft website. Naturally, having previously selected the operating system used and its bit depth.

Reset IE settings

You will need to go to this point if the hard drive is guaranteed to have the 11th version of Microsoft's proprietary browser, but the error still continues to appear when launching Skype. If this is the case, then you need to repeat the following operations:

  • Initially, close absolutely all running applications and system windows;
  • Launch IE;
  • Click on the gear icon and select “Internet Options” from the list;
  • In the next window, activate the “Advanced” tab;
  • In it select “reset parameters”. Click on “reset”;
  • Confirm your actions. And after completing the procedure, be sure to restart your personal computer.

Check the result.

Java Setup

It is logical that the Java script should be configured correctly. After all, if you do not do this, then it is quite possible that this particular error will manifest itself. Yes, first of all, you should set the parameters correctly for Internet Explorer. But if the PC owner also uses other browsers, then it’s worth double-checking them too.

Settings for Internet Explorer

The following instructions need to be repeated:

  • Launch your web browser, click on the gear and go to “Internet Options”;
  • Activate the tab called “Security”. Highlight the Internet icon. Click on the “Another level” button;
  • Go to "Scripting". Next in – “Active Scripting”. Set out of three values ​​the one called “Enable”;
  • The system will ask for confirmation. Click on yes. Close a window;
  • Next to the address bar, click the button responsible for refreshing the page.

Setting for Google Chrome

Naturally, Google Chrome is initially activated. Further:

  • Click on the three vertical dots that can be found in the upper right corner of the working screen;
  • A drop-down menu will appear. In it you need to go to the “Settings” section;
  • Scroll down to the very bottom of the page. Click on “Advanced”;
  • Go to “privacy and security”, where you should click on “content settings”.

All that remains is to select “JavaScript” and set the value to connected.

Making your life easier

  1. I recommend making it a rule: before starting each development, centralize any logging, especially errors. Libraries like log4js will help you cope with this task. This will immediately let you know whether there is an error in your application or from the outside.
  2. Use Breakpoints in DevTools! It is important to be able to do this. It's like a program time machine, you stop the interpreter at the desired line and you don't even need the console - just look at the values ​​of the variables and you'll understand what's wrong. This is done by simply clicking on the desired line in the Source tab. Select the desired file, set a breakpoint and restart the program. To remove a breakpoint, click on the same line.
  3. Try to catch all errors and exceptions at the top level.
  4. Storing errors on the server is more of a product issue, but keep in mind that an off-the-shelf tool does a great job of this (see below).
  5. Profiling is also not an easy topic, if you know that it is measuring the time from the beginning to the end of the execution of a monad, you are already halfway there. Fortunately, DevTools allow you to take measurements without interfering with the code.

These rules are a priori necessary, even if you are an experienced developer, you always need to know how the program behaves at a specific point in time.

Reviews

Reviews will help you figure out what exactly helped other people in a similar situation:

  1. Oleg. By the way, I did the same with Skype as written in the Discord instructions. That is, he completely removed the program, having previously cleared all traces of it that might have been running. And then I installed a new version, as they say, from scratch. And my problem was immediately resolved.
  2. Semyon. At first, I also started to take everything out of the folder. But the system simply did not allow me to do this, saying that the files were, they say, open somewhere else. Then I went, as written in the instructions, to the task manager. I completely deactivated everything. Once again I moved on to deleting. And everything worked out! Next is a matter of technology. Find a normal package, download it and install it.
  3. Valery. Important point. When navigating to folders from which you need to delete something, make sure that they are not in hidden mode. That is, initially you need to set the settings in such a way that all folders on the hard drive are visible to the user. Otherwise, you simply won’t be able to find the elements you need. This means completing the instructions.
  4. Arkady. I tried everything. And here, it turns out, you also need to enable Java in the IE settings. I specifically went to the right section. And I saw that the necessary scripts were in an inactive state. Of course, everything was set up as it should be. And Skype began to function normally. And then this error always popped up, I didn’t even know what to do with it or how to fix it.
  5. Natalia. I had this problem literally a month ago. And I'm not very computer savvy. She called her son. I came and looked. He said that my Skype was very old and just needed to be updated. I installed the normal version. I made it update automatically. Plus, I finally replaced the previously standing XP with the modern Ten. And now I don’t have any problems - I communicate normally with my friends and at work.

So what are these techniques for?

The answer is to conduct simple and reliable development. Your task as a developer is to create fault-tolerant code and when an error occurs, do not debug everything, but immediately hit the bull’s eye and fix the problem. It simply saves your business time, effort and money.

Work with DevTools and throw exceptions, other developers will thank you based on this guide. Be sure to check it out if you didn’t know, here’s an example:

// … /* a regular console.log can turn into something more */ /* as a rule, novice programmers log by one variable, but we can format lines with any number of arguments */ console.log('Check:\r\n username - %s\r\n age - %i\r\n data - %o', 'Mike', 23, {status: 'registered'}); /* Check: username - Mike age - 23 data - {status: "registered"} */ /* display array tables */ console.table([{username: 'Mike', age: 23}, {username: 'Sarah ', age: 46}]); /* or just log the data in its original form */ console.dir(document.body.childNodes[1]); //...

Next, let's look at tools that collect data not only from components, but also from services (for example, network requests, device requests, etc.), as well as third-party libraries and applications, which greatly improves your performance when handling errors.

How to fix the “JavaScript error occurred in the main process” error

To fix this error, you need to open the folder on your computer or laptop where the Discord program files were installed. We will need 2 folders of the Discord program - “AppData” and “AppDataLocal”. In some versions of Windows, folders may be hidden by default. Therefore, to open the folders we need:

  1. Open the Start menu.
  2. Select Run. You can also press Win+R to quickly access Run from the desktop.

Asynchronous mechanisms - promises

To perform asynchronous operations in JavaScript, it is better to use promises rather than callbacks. Here, in addition to improved code readability, there are also more advanced error handling mechanisms. Namely, there is no need to mess around with an error object that might end up in a callback function when using promises. Here a special catch block is provided for this purpose. It catches all errors that occurred in promises that come before it, or all errors that occurred in the code after the previous catch block. Note that if there is an error in the promise that there is no catch block to handle, this will not stop the script from executing, but the error message will not be particularly readable.

As a result, we can always recommend using a catch block when working with promises. Let's look at an example.

Fixing the error A fatal JavaScript error occurred in Discord

To eliminate an error of this kind, you need to carry out the following manipulations:

  1. Go to the Start menu.
  2. Click Run or call this tab with the Win+R key combination.
  3. In the window that appears, enter the following phrase %localappdata% and %appdata%. This will allow us to open hidden folders to clean them out.

  4. We go to each of the specified folders one by one and delete all files whose names include the word d
  5. Now you should completely shut down the messenger D The most proven option is to go to the task manager, which is easiest to call with the Ctrl+Alt+Del key combination, and remove the Discord task from running.
  6. Next, remove the entire program from your device and reinstall it again.

If you did everything correctly, then after reinstallation the Discord messenger should work properly.

If, during an anti-virus scan, the device indicated the presence of errors and viruses in the program itself, then first of all it is necessary to clean the computer of malicious files.

If after this the error A fatal JavaScript error occurred continues to appear while Discord is running, then you need to reinstall the program according to the algorithm described above.

Instructions for cleaning the “hosts” file

  1. Go to “My Computer” and open the system folder Widows/system32. It contains a drivers folder, in which we need the one called etc. Among the files stored in this last folder will be the hosts we need. Open it using Notepad or the WordPad text editor.
  2. You will see the contents of this file as a text entry. In this case, in a healthy (not infected with a virus) file, the entry is limited to the following data: 127.0.0.1.localhost.
  3. If you find that in addition to the specified text, there are other entries in the file, then this is nothing more than garbage left by a cunning virus. It is he who prevents programs on the VKontakte website from working normally, blocking access to them.
  4. We need to get rid of unnecessary records. We completely clear the document (for better security) and re-enter the desired message. Save the changes and close the editor.
  5. Now you need to restart your computer, after which the error should disappear. Try going to your social network page and listening to audio files, as well as opening videos. The JavaScript Error "VKontakte" no longer appears.

This method is the most reliable, but at the same time quite simple. Typically, it helps resolve issues related to JavaScript errors. To prevent such troubles, check the operation of your antivirus. If necessary, update it or install a new one, because reliable computer protection is the basis for uninterrupted operation, including when using sites on the World Wide Web.

Rating
( 1 rating, average 5 out of 5 )
Did you like the article? Share with friends:
Для любых предложений по сайту: [email protected]