bradtraversy / meanauthapp

Complete MEAN stack app with authentication
242 stars 152 forks source link

SyntaxError: Unexpected token < in JSON at position 0 #45

Open Robmcmon opened 6 years ago

Robmcmon commented 6 years ago

Everything works however when I click on profile I am getting this error

SyntaxError: Unexpected token < in JSON at position 0

and then nothing displays besides the Nav bar as the content that is suppose to show up on this profile section does not display.

I realize this error is caused by HTML being returned instead of JSON. But I'm unsure how to correct it as it relates to the profile section. I've looked over all of the code.

Any help would be appreciated.

IsaacDrone commented 5 years ago

I am having the same problem. I worked through the tutorial, and even redid it with the updated angular/cli, but when i got to the profile page i got a similar error "SyntaxError: Unexpected token p in JSON at position 0".

i'm fairly new to the mean stack, so, i'm dead stuck here. however, with what little knowledge i have, the issue seems to be coming up with the auth.services.ts in the getProfile function line .map(res => res.json());

i don't know if there is a work around or fix.

have you found a solution to this yet? thank you.

Robmcmon commented 5 years ago

I did actually get past this error but don't remember how I fixed it sorry.

tomcatbuzz commented 5 years ago

@IsaacDrone read the other issues and comments for this Repo, I am sure the answer has been posted. It has been a common issue due to Changes from old Angular versions.

IsaacDrone commented 5 years ago

Thanks guys. I fixed the syntax issue, and something else popped up also. I've been sorting our the angular version changes the whole time, and this profile page is plaguing me. I suppose debugging this stuff is good for a newbie like me. @tomcatbuzz I will go read through the other issues and comments. Thank you.