Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/ga-lite.min.js:7 Uncaught SyntaxError: Unexpected token < #58

Closed
frank6tg opened this issue Apr 23, 2018 · 17 comments
Closed

/ga-lite.min.js:7 Uncaught SyntaxError: Unexpected token < #58

frank6tg opened this issue Apr 23, 2018 · 17 comments

Comments

@frank6tg
Copy link

I downloaded the minified js file so i could serve it from my server for performance and I in Google Chrome console reports an error in the syntax. I was unable to determine why this has an error.

@jehna
Copy link
Owner

jehna commented Apr 23, 2018

Hey, thanks for the bug report! Can you paste the error here?

@jehna
Copy link
Owner

jehna commented Apr 23, 2018

Ah, it was the one in the title I assume

@jehna
Copy link
Owner

jehna commented Apr 23, 2018

Is the site public?

Can you make sure the .js file is served correctly by visiting the direct url?

"Unexpected token <" refers usually to a 404 HTML page being served instead of the correct js file

@jehna jehna added the bug label Apr 23, 2018
@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@jehna
Copy link
Owner

jehna commented Apr 23, 2018

Yep, .js URL seems to serve a HTML page:
https://wptechguru.com/ga-lite.min.js

So can you check that you have uploaded the file to correct place and that your CDN cache is cleared, routes configured correctly etc.

Somehow you should get the URL to return the correct ga-lite.min.js file :)

@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@jehna jehna added help wanted and removed bug labels Apr 23, 2018
@jehna
Copy link
Owner

jehna commented Apr 23, 2018

If you're using WordPress, you probably uploaded the ga-lite.min.js file to your server. Did you upload it to the site's root? If so, you probably have an issue in you .htaccess that prevents loading that file directly and you could try uploading it to e.g. your theme folder.
If you uploaded the file to your theme folder, you should use URL like https://wptechguru.com/wp-content/themes/yourtheme/ga-lite.min.js

@jehna
Copy link
Owner

jehna commented Apr 23, 2018

And just to be clear: The issue is that https://wptechguru.com/ga-lite.min.js is not the same as https://raw.githubusercontent.com/jehna/ga-lite/master/dist/ga-lite.min.js

@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@jehna
Copy link
Owner

jehna commented Apr 23, 2018

Ahh, now I think I know what happened. You must have downloaded this page:
https://github.com/jehna/ga-lite/blob/master/dist/ga-lite.min.js (html page that shows the file)
...instead of this:
https://raw.githubusercontent.com/jehna/ga-lite/master/dist/ga-lite.min.js (source file)

In the future you can click the Raw button at the top-right of the page to download the correct file.

@jehna jehna closed this as completed Apr 23, 2018
@frank6tg
Copy link
Author

frank6tg commented Apr 23, 2018 via email

@jehna
Copy link
Owner

jehna commented Apr 23, 2018

No worries, glad we got the lib working :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants