Unexpected identifier 'h'. Expected ';' after variable declaration - javascript

I've been reading other posts of similar errors, but the problem always seem to be not so obvious from the error message. Not sure how to approach this.
I've searched my entire project for the letter "h" to see if I can find one that is out of place but nothing comes up.
I've went through all my project files but nothing seems out of order.
I'm using TS and nothing seems to suggest a typo error.
Is there a way I can get more information on this error? Th title is all that I am getting.
EDIT: This is the entire repo https://github.com/Tsabary/deliveroo-clone
Not placing any code because I actually have no idea where this is coming from.
EDIT 2: I didn't touch my code at all, but clicked the reload on my android emulator, and now instead of the previous message, it says Unexpected identifier 'get'. Expected a parameter list for getter definition.

I need to move the project to a different location so prior to that I've deleted my package-lock.json and my node_modules, moved the project and reinstalled them. Everything seemed to be installing just fine so didn't even think of it as the issue.
I've again deleted everything and reinstalled, and now everything works, so I guess the error was somewhere in a faulty module installation.

Related

Issue with Google Tag Manager implementation. "Uncaught TypeError: Wb.set is not a function"

Recently I started having Issues with the Google Tag Manager.
I can't track it to a Tag or a Trigger (activated and deactivated individually to check).
The error started occurring this week (no updates were made to the system or template). I noticed when testing the implementation of a new Tag in GTM. That shortly worked but then this error message started showing in the console. Removing the new Tag didn't change the situation and since the code worked for a while (some 30minutes) I don't expect a direct relationship between the new tag and the error.
All I have is the console in the frontend that shows the following error message:
Uncaught TypeError: Wb.set is not a function
The error stems from this file:
https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX
Wb is started as a Map just a few steps earlier:
Wb=new Map(Vb.h.F);
Wb.set("style",{ya:4});
The GTM Script is copied and pasted from the GTM-Admin without any change made to it and is included in the header.php file of the Wordpress template. I tried copying it again and replacing the script that was in the header.php previously but the result was the same.
If looking at the actual error message in the console helps, the issue can be seen on the following URL:
https://www.bindella.ch
Any help in solving this or at least pointer to where to go look for errors would be very much appreciated.
Thanks
Very interesting, and yes, you're right, the error in the minified code makes no sense:
Let's try something different. First, just export your GTM container (the workspace that is synced with prod/live) as a JSON file in Admin section.
Open the file, look for something like set("style" See if you can find that Wb. Well, don't expect it to be Wb. I guess GTM minifies the code. It may be some weird chat bot, or something like that. From there, you'll be able to find the tag or variable that causes the issue.
I didn't look too deep into it, but that part of code looks sophisticated enough to be a part of the core container code. Actually, we can check it right here, on SO cuz it uses GTM too, let's do that.
Yes, SO has identical code. Looks like it's indeed core GTM. Well, there's a tiny probability that when you built the prod library last time, GTM had an issue and it deployed an artefact.
Try making a new workspace, make a nonsensical change in it and publish it to production. See if it lets you publish. Then see if that fixes the issue.
Now, if it doesn't then the next thing I'd try is trying to re-importing the exported JSON, forcing GTM compare the import to what's there and find differences.
Now if that shows no issues, then I would make a brand new container, load the config in it and try replacing the gtm loading script to see if the error still happens. It sounds like you can do that. If you can't, look a plugin like redirector to redirect the request to a different container.
Still the error with the new container? How about if you load a completely empty container? Got any errors?
There's a very slim chance that your front-end deploys one of a few vars GTM uses too, thus conflicting with your GTM. But it's very unlikely. Why would you use something like google_tag_manager or google_tag_data in the global scope...
If nothing helps and only the empty container doesn't give errors, then... well, then make a list of all tags firing along that error and start disabling them one by one. Or use breakpoints to narrow it down to the tag/library that causes it.

Opencart - cant change js files. adding kind of reddots at the end

firstly very sorry, I cant find out what the real problem is.
I ll try to explain.
My client given code which is developed using opencart and nitropack.
he includes common.js in header, it is basic js file with some ajax calls, UI events etc which has 1297 lines(no formating in code, lots of blank spaces, blank lines etc).
my real problem is, when I made any changes in this file,
the browser console is throwing error invalid or unexpected token.
I checked the common.js file in browser console, seeing that some kind of reddots added at last of the file. I just added a alert() at the begining of file. nothing else.
very sorry, dont know how to explain more detaily.
This is the first time I have seen this kind of issue.
when I removed the alert(), the error gone.

WebStorm all initialized variables throw error expected BEGIN_ARRAY was BEGIN_OBJECT

I have the following problem:
I have recently started working on another PC with WebStorm 2016.1.3.
The code that was written before that on the previous PC works fine. But writing on this one, screws everything up.
Whatever variable I initialize, I get error:
com.google.gson.JsonParseException expected BEGIN_ARRAY was BEGIN_OBJECT at line 1 column 1217.
Here is debug snapshot:
You can see how the first array is okay, but the rest is just screwed. Really weird problem, and I suspect the IDE. Anyone had that issue?
There was a problem with the cache of the browser and the IDE. It fixed itself after restart and cache kill.

debugging javascript console error

I just got some big project and with error in console. there are many more than scripts used at that page but error shows very little information. there are 25 scripts loading at page. To give you an idea how many scripts they are you can see. :(
I have error in console but i can't find which original file, line number causing it. the error showing are in library. but i know it's not library bug it's caused by some other script. but this stack trace is very small. is there any tool or any other way where i can originally find from where it is originating.
let me know if further information is required.
If you click on link "amstock.js" you will be redirect to that file and directly in the line that was causing the error. Always the upper file is which causes the problem, but some times because of a previous one.
In adition, the error maybe cause by an asynchronous call that leaves your variable in null and fill it after the line of the error was call, or just you are trying to access a wrong variable. Check that line.

Syntax check passes but uncaught SyntaxError: Unexpected identifier

Guys what else could be wrong when jshint, esprima all passes the code but chrome throws this error ? I am having a hard time figuring out.
P.S : Sorry I can't really share the code as I am not supposed to and I have to share the whole app code.
If you can't share the code, it will be hard for anyone to tell you what is wrong.
One thing you can do is simplify your code down to a concise test case, using the "divide and conquer" technique. Just start taking out big chunks of code, and keep repeating until one of the following happens:
The error goes away. This means the problem was in the last chunk of code you deleted. Put that code back in and take out only part of it and test again. Repeat this as needed.
Some other error crops up that wasn't there originally. Put back the last deleted chunk and either try deleting only a part of it, or deleting something else.
The error remains, but now there is so little code left that you will either see what the problem is, or else you won't have a problem posting it here for help. Once you have it down to a minimal test case like this, you can start renaming variables and functions so that it no longer reveals any company secrets.

Categories

Resources