fnakstad / angular-client-side-auth

One way to implement authentication/authorization in Angular applications
http://angular-client-side-auth.herokuapp.com/
MIT License
1.63k stars 346 forks source link

Unexpected token '<' #67

Closed renjith01 closed 10 years ago

renjith01 commented 10 years ago

Let me thank you first for this implementation, but I am getting SyntaxError: Unexpected token '<' in the browser console while trying to run locally. Tried both in bot mac and windows. Am I missing something?

fnakstad commented 10 years ago

Hi! I can't seem to reproduce your problem. Are you using a clean build or are there local changes in your repo? Does this happen as soon as you open the web app in the browser? Any error messages in the server console?

geyang commented 10 years ago

Yeah, this is a typical problem when one of your resources defined in the index.html file is missing.

If you check the console.log in your server terminal, you might be able to figure out which one is missing. The missing one should have a 404 status code, while all the other ones are either 200 or 304 (cached).

Ge

On Thu, Feb 27, 2014 at 7:49 PM, Frederik Nakstad notifications@github.comwrote:

Hi! I can't seem to reproduce your problem. Are you using a clean build or are there local changes in your repo? Does this happen as soon as you open the web app in the browser? Any error messages in the server console?

— Reply to this email directly or view it on GitHubhttps://github.com/fnakstad/angular-client-side-auth/issues/67#issuecomment-36314294 .

geyang commented 10 years ago

Hey fnakstad,

Do you think this might be the underscore.js file? I remember that from the message from the other pull-reuest from yesterday.

Ge

On Fri, Feb 28, 2014 at 3:08 AM, Ge Yang yangge1987@gmail.com wrote:

Yeah, this is a typical problem when one of your resources defined in the index.html file is missing.

If you check the console.log in your server terminal, you might be able to figure out which one is missing. The missing one should have a 404 status code, while all the other ones are either 200 or 304 (cached).

Ge

On Thu, Feb 27, 2014 at 7:49 PM, Frederik Nakstad < notifications@github.com> wrote:

Hi! I can't seem to reproduce your problem. Are you using a clean build or are there local changes in your repo? Does this happen as soon as you open the web app in the browser? Any error messages in the server console?

— Reply to this email directly or view it on GitHubhttps://github.com/fnakstad/angular-client-side-auth/issues/67#issuecomment-36314294 .

renjith01 commented 10 years ago

I don't find anything in 404 status. I am able to reproduce the issue in a new installation. Not sure ii the issue is due to bower caches. I was able to install one instance successfully after I manually installed some components which was not fetched by npm install command yesterday like supertest, passport stub and karma-chai . But I am not able to reproduce the success scenario again. I had used npm set strict-ssl false also also npm install --unsafe-perm logs in console uncaught SyntaxError: Unexpected token < angular.min.js:1 Uncaught SyntaxError: Unexpected token < angular-cookies.min.js:1 Uncaught SyntaxError: Unexpected token < angular-ui-router.min.js:1 Uncaught ReferenceError: angular is not defined app.js:3 Uncaught ReferenceError: angular is not defined services.js:3 Uncaught ReferenceError: angular is not defined controllers.js:5 Uncaught ReferenceError: angular is not defined directives.js:3

geyang commented 10 years ago

I think your error messages suggest that your angular.min.js is missing, angular-cookies is missing, angular-ui-router is missing.

Can you check if those are accessible in a browser?

Ge

On Fri, Feb 28, 2014 at 3:59 AM, renjith01 notifications@github.com wrote:

I don't find anything in 404 status. I am able to reproduce the issue in a new installation. Not sure ii the issue is due to bower caches. I was able to install one instance successfully after I manually installed some components which was not fetched by npm install command yesterday like supertest, passport stub and karma-chai . But I am not able to reproduce the success scenario again. I had used npm set strict-ssl false also also npm install --unsafe-perm logs in console uncaught SyntaxError: Unexpected token < angular.min.js:1 Uncaught SyntaxError: Unexpected token < angular-cookies.min.js:1 Uncaught SyntaxError: Unexpected token < angular-ui-router.min.js:1 Uncaught ReferenceError: angular is not defined app.js:3 Uncaught ReferenceError: angular is not defined services.js:3 Uncaught ReferenceError: angular is not defined controllers.js:5 Uncaught ReferenceError: angular is not defined directives.js:3

— Reply to this email directly or view it on GitHubhttps://github.com/fnakstad/angular-client-side-auth/issues/67#issuecomment-36336203 .

fnakstad commented 10 years ago

Yea, my guess is that something goes wrong when fetching dependencies with bower. Could you check if the client/components folder exists and if it contains the packages defined in bower.json? If this is the case you can try running bower install to fetch them again.

jshemas commented 10 years ago

I'm getting the same problem, but running bower install seemed to fix it.

fnakstad commented 10 years ago

Hmmm, I see... I tried adding bower install as a postinstall script to npm install, so that you only have to execute one command instead of two to install dependencies. However it seems many of you are having trouble with it... Could any of you guys experiencing this problem try executing grunt clean, and then npm install to see if the problem persists?

austinpray commented 10 years ago

I tried adding bower install as a postinstall script to npm install

YOU CAN DO THAT???? ༼ つ ◕◕ ༽つ fnakstad ༼ つ ◕◕ ༽つ

fnakstad commented 10 years ago

Well, now that people are reporting problems I'm not so sure anymore, but this works for me :) Note that you need to add bower as a dependency in npm, so you can use a local install of it in case it's not installed globally.

fnakstad commented 10 years ago

Reverted to relying on global install of bower, so I'll go ahead and close this.

austinpray commented 10 years ago

Global install is a common pattern anyway. No need for duplicate bower binaries

brunaobh commented 9 years ago

bower install.. fix the problem here

ghost commented 9 years ago

I have been fighting this problem for a few hours and finally noticed something not mentioned previously (Here or at SO)... In ASP.NET/MVC application this error (Unexpected token '<' ) can result from attempting to call @Scripts.Render("...") on a non-existent bundle.

D'OH

AskYous commented 8 years ago

I received this issue as well just now. Though, the problem with mine was that I typed an incorrect URL:

index.html/#/ gives the error. index.html#/ solved it.

garvitsharma commented 7 years ago

I think your error messages suggest that your angular.min.js is missing,

divya12prakash commented 6 years ago

I am using angular 4, but even after re-installing the dependencies through npm or other suggestions do not work for me

KathRains commented 6 years ago

I had the same problem. And no any 404 errors. But it was actually missing file. It looked like files have been downloaded but actually, Node.js server downloaded some default page instead of them. It turned out I screwed up with paths. Why server exposed such behavior I don't know. As soon as I add "base" to the header everything was fixed.

Mujtaba81 commented 6 years ago

I am getting this error both locally as well as while using cloud IDE c9.io

"Uncaught SyntaxError: Unexpected token <"

KathRains commented 6 years ago

Mujtaba81, looks like you have a missing file too. I'm pretty sure if you look at your response in Chrome you will see the HTML of 404 error, not JavaScript, that's why you have this error.