Skip to content

Uncaught SyntaxError: Unexpected token < #2708

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

Closed
1 task done
JosephSKh opened this issue Apr 17, 2018 · 15 comments
Closed
1 task done

Uncaught SyntaxError: Unexpected token < #2708

JosephSKh opened this issue Apr 17, 2018 · 15 comments

Comments

@JosephSKh
Copy link

  • I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
Item Version
generator-angular-fullstack 4.1.x
Node 8.9.4
npm 5.6.0
Operating System Ubuntu 15.10
etc etc
Item Answer
Transpiler TypeScript
Markup HTML
CSS CSS
Router ngRoute
Client Tests Jasmine
DB MongoDB
Auth Y
etc etc

I get Uncaught SyntaxError: Unexpected token < in the browser after the initial launch of the generator and stuck at Loading...

@Awk34
Copy link
Member

Awk34 commented Apr 19, 2018

What are the steps you take to run your app?

@JosephSKh
Copy link
Author

JosephSKh commented Apr 21, 2018

@Awk34 I'm using the configurations above, I've already started my mongo db engine, and i use gulp serve

@JosephSKh
Copy link
Author

@Awk34 a small hint, sometimes it works with npm run start:client ,,, but never with gulp serve

@albert-92
Copy link
Contributor

Are you sure you are using 4.1.x and not 5.x.x?

#2711 has the same Problem for 5.0.0-rc1.

Check https://angular-fullstack.github.io/get-started/running/

It is npm run start:server and npm run start:client instead of gulp serve in 5.x.x

@JosephSKh
Copy link
Author

JosephSKh commented Apr 21, 2018

@albert-92 you mean it's gulp serve for AngularJs and npm run start:whatever for Angular 2+ ?

@JosephSKh
Copy link
Author

@albert-92 oh ok I think that explains it, I'm using v5.0.0-rc.1

@albert-92
Copy link
Contributor

you mean it's gulp serve for AngularJs and npm run start:whatever for Angular 2+ ?

Exactly

@koraysels
Copy link

koraysels commented Jun 11, 2018

I also have this problem. I am running npm run start:server and npm run start:client and still I get the unexpected token error and it is stuck on the "Loading... "

@fedfigca
Copy link

I think the problem is we're pointing our browsers to port 9000 but the full webpack/gulp magic is happening at 8080, the output of the npm run start:* is confusing and the only url we see is localhost:9000 so we go there by mistake...
The error is because express sends app.html as the javascript files because of the routing in the plain server running at 9000

@JosephSKh
Copy link
Author

@koraysels make sure you are using Version 4.1.x not v5.0.0-rc.1
Run npm run start:server then npm run start:client

@koraysels
Copy link

what do you mean ? I want angular fullstack with angular 2+ .. It is working if i go to port 8080 instead of 9000. so that's a win! now I only need to figure out how to get the 'client' working in a docker container.. 'server' is working but 'client' does nothing :(

@Awk34
Copy link
Member

Awk34 commented Jun 12, 2018

npm run start:client should always display that it's output is shown at localhost:8080 (or a different port if you changed it. This is coming directly from Webpack.

I appreciate the comments. I can only improve the project with either direct contributions or specific comments I can take action on.

There's a super-old PR I made involving Docker: https://github.com/angular-fullstack/generator-angular-fullstack/pull/2290/files . I plan on re-doing this in the future, so the PR isn't quite up-to-par, but it might give you some more info @koraysels

@malkyfaith
Copy link

My 'npm run start:client' runs fine but 'npm run start:server' causes this "Uncaught SyntaxError: Unexpected token <". I am not understanding what's the problem?
I am using

  • Angular 5
  • Generator-angular-fullstack - 5.0.0-rc.2
  • Node - 6.11.3
    I haven't had a smooth journey while playing on MEAN stack using generator-angular-fullstack.
    I even struggled a bit in using DI for Angular 5. I used forwardRef to inject my dependency.

@Awk34
Copy link
Member

Awk34 commented Jun 18, 2018

@malkyfaith are you opening your browser to http://localhost:8080?

@malkyfaith
Copy link

@Awk34 I am running two different power shells to access client on 8080 and server on 9000.

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

No branches or pull requests

6 participants