Nginx and angular: Uncaught SyntaxError: Unexpected token <

Viewed 4404

so my problem is, that nginx is apparently not loading all the dependecies for angular defined at the beginning of the .html view.

This is an excerpt from the start_game.html

`
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />

    <!--<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,400italic'>-->
    <link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,400i,700,700i" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="/../node_modules/angular-material/angular-material.css"/>
    <link rel="stylesheet" href="/../app/assets/app.css"/>

    <script src="/../node_modules/angular/angular.js"></script>
    <script src="/../node_modules/angular-animate/angular-animate.js"></script>
    <script src="/../node_modules/angular-aria/angular-aria.js"></script>
    <script src="/../node_modules/angular-environment/dist/angular-environment.js"></script>

    <script src="/../node_modules/angular-material/angular-material.js"></script>


    <script>
        angular.module("startGame", ['ngMaterial']);
    </script>

    <script src="/start_game.js"></script>
`

The nginx.conf file looks like this

`server { # Used to set address and/or port for IP. listen 80; server_name localhost; include /etc/nginx/mime.types;

            location /console {
                    proxy_pass http://jatos-backend;
            }

            # all other traffic
            location / {
                    root /usr/share/nginx/html;
                    try_files $uri /trust/start_game/start_game.html$is_args$args;
                    include /etc/nginx/mime.types;
            }

            location /start_game {
                    return 404;
            }

    }

`

When requesting http://localhost i get the following errors Console errors

but the actual path http://localhost/trust/start_game/start_game.html directly to the view resolves without any issues.

Thank you for your time

0 Answers
Related