简体   繁体   中英

SyntaxError: expected expression, got '<' on Heroku

When I click on the index.html file on my local computer, the page is correctly loaded in my browser. However, when I open the site on herokuapp, I get "SyntaxError: expected expression, got '<'" errors for all of the .js files I link to in the html.

错误截图

I would appreciate any help on how to fix this.

Thanks!

The links are propably not working when installed on Heroku. Use the net panel of firebug or your browser developer tools to see which absolute URL the browser is trying to load. Most likely it is invalid and a HTML 404 error page is returned (starting with a '<')

About Angular + Heroku , The error was in server.js.. My path of express.static was wrong.. also in res.sendfile for index.html

The correct path should be ./dist/<name-in-package.json>

That resolved my error.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM