Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

Here is the code of my index.html:

<html>
  <head>
    <meta charset="UTF-8" >
    <title>Index</title>
    <link rel="stylesheet" href="styles/main.css" />
    <link rel="stylesheet" ng-href="bower_components/bootstrap/dist/css/bootstrap.min.css" />
 </head>
 <body ng-app="app">


    <div ng-view></div>

    <script src="bower_components/angular/angular.min.js"></script>
    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="bower_components/angular-route/angular-route.min.js"></script>
    <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
    <script src="scripts/angular/app.js"></script>
    <script src="scripts/angular/controllers.js"></script>
 </body>
</html>

However, it shows the error in return:

bootstrap.min.js:1 Uncaught SyntaxError: Unexpected token <

ui-bootstrap-tpls.min.js:1 Uncaught SyntaxError: Unexpected token <

bootstrap_error

Is it the problem of my code or bootstrap? I found the error exists when I add

<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> 

and

<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script> 

into the index.html. Anyone knows the cause of the error? Thanks :)

share|improve this question
    
Have you looked inside the files? Is there something wrong with them? – Hubert Grzeskowiak Sep 28 at 15:55
1  
Your webserver is most likely returning a default error message, which is in html. Probably a 404. – tcooc Sep 28 at 15:56
    
Can you download the JS files by the given URLs using a browser? I think @tcooc is right. That's a HTML response from the server. – Hubert Grzeskowiak Sep 28 at 15:58
    
You say "it shows an error". What is showing an error? When is this error shown? If it is your development environment, you can probably safely configure your development environment to ignore this error. – BPS Sep 28 at 16:14
    
Thanks you guys, it is the problem of bootstrap.min.js. A whole set of HTML is stored inside the js while the bootstrap is retrieved from bower.... – seeseesky Sep 28 at 16:18

Its definitely a problem with the bootstrap file. The line 1 contains '<'.

Try manually opening the files and removing it.

share|improve this answer
    
Thanks!! I checked the bootstrap file and found that the index.html code is saved inside...I am now using bootstrap CDN link instead of bootstrap installed from bower and it is now solved. Although I still cannot figure out why index.html code will be saved inside the bootstrap.min.js while it is retrieved from bower... – seeseesky Sep 28 at 16:16
    
Glad it helped!! Could you mark this as the answer? – Bharath Oct 1 at 1:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.