I have deployed angular 4 app using nginx. But its unable to load js,css and other files. I see these error in console
Uncaught SyntaxError: Unexpected token < inline.bundle.js:1
Uncaught SyntaxError: Unexpected token < polyfills.bundle.js:1
Uncaught SyntaxError: Unexpected token < scripts.bundle.js:1
Uncaught ReferenceError: webpackJsonp is not defined at styles.bundle.js:1 styles.bundle.js:1 (anonymous) @ styles.bundle.js:1
Uncaught SyntaxError: Unexpected token < vendor.bundle.js:1
Uncaught ReferenceError: webpackJsonp is not defined at main.bundle.js:1 main.bundle.js:1
My nginx configuration:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#alias /web-portal/;
root /var/www/html/web-portal/;
try_files $uri$args $uri$args/ /index.html =404;
}
}
Kindly Help Me to solve This !!
It seems to be a duplicate of " Syntax Error in Angular App: Unexpected token < ".
Please check (and/or share us) your base href
attribute in your project.
It could be related to your issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.