angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.13k stars 1.24k forks source link

Grunt Build not finding js files. #627

Closed BryceHayden closed 9 years ago

BryceHayden commented 10 years ago

OK I'm not sure what's going on with grunt build, but it doesn't seem to find the javascript files when I run grunt build. This happens when I update the index file...often I will move to a different computer and do a pull from my git stash repo and it will start to fail. I don't understand the error as I can fix it by replacing the index.html file with the original one created from yo angular-fullstack and then adding back the html code I want. It seems to occur when I alter the build:js sections or anything below the Google analytics.

So for example the program can work perfectly fine on my laptop so I'll push to my git repo. Then I will move onto my desktop and pull. It won't show there being anything different with my index.html page but I'll get the following error in the browser's console:

GET http://localhost:8080/assets/images/loading.gif 404 (Not Found) (index):60
GET http://localhost:8080/app/assignment-meeting/prepare-senior/candidate/profile/_profile-ctrl.js  (index):102
GET http://localhost:8080/app/assignment-meeting/prepare-senior/candidate-list/candidates-list-controller.js  (index):100
GET http://localhost:8080/app/assignment-meeting/prepare-senior/candidate/_candidate-ctrl.js  (index):101
GET http://localhost:8080/app/assignment-meeting/prepare-senior/candidate/summary/_summary-ctrl.js  (index):103
GET http://localhost:8080/app/home/home-controller.js  (index):104
GET http://localhost:8080/components/services/candidate-services.js  (index):109
GET http://localhost:8080/components/auth/User.js  (index):106
GET http://localhost:8080/app/routes.js  (index):105
GET http://localhost:8080/components/directives/napi-ck-editor.js  (index):108
GET http://localhost:8080/components/auth/user-service.js  (index):107
GET http://localhost:8080/components/services/http-helper.js  (index):110
GET http://localhost:8080/components/services/menu-services.js 404 (Not Found) 

Going back to my laptop and comparing it to the version on my repository, it doesn't show any difference. I'm wondering if it has to do with line endings. I'm getting really tired of having to recopy the original index.html code so I'd greatly appreciate any insight into this. Oh here's my html page:

<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" ng-app="napiRest"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" ng-app="napiRest"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" ng-app="napiRest"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" ng-app="napiRest"> <!--<![endif]-->
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <base href="/">
    <title data-ng-bind="pageTitle"></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">
    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
    <!-- build:css(client) app/vendor.css -->
      <!-- bower:css -->
      <!-- endbower -->
    <!-- endbuild -->
    <!-- build:css({.tmp,client}) app/app.css -->
    <link rel="stylesheet" href="app/app.css">
      <!-- injector:css -->
      <link rel="stylesheet" href="./bower_components/jquery-ui/themes/smoothness/jquery-ui.min.css"/>
      <!-- endinjector -->
    <!-- endbuild -->
  </head>
  <body>
    <!--[if lt IE 7]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->

    <!-- Add your site or application content here -->
    <header class="hidden-print">
        <div class="row">
            <div class="col-xs-6">
                <div class="vertical-center">
                    <a data-ui-sref="home">
                        <img src="assets/images/top-main.gif"/>
                       Management System
                    </a>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="vertical-center pull-right">
                    Signed In As:&#160; {{username}}
                    <img src="assets/images/divider.gif"/>
                    <a data-ui-sref="display-help">Help</a>
                    <!--<a href="javascript:;" onclick="displayHelp()">Help</a>-->
                    <img src="assets/images/divider.gif"/>
                    <a href="MMSProceduresManual.pdf" title=" Management System Help Manual"
                       target="_blank">
                        Printed Manual
                    </a>
                    <img src="assets/images/divider.gif"/>
                    <a data-ui-sref="sign-out">Sign Out</a>
                </div>
            </div>
        </div>
    </header>

    <nav class="hidden-print">
        <div class="vertical-center">
            <a data-ui-sref="home">Home</a>
        </div>
    </nav>

    <div id="load-me" style=";opacity: 0.8; z-index: 9999; position: absolute;top: 0;left: 100%; bottom: 0; right: 100%; display: none; padding: 10px; background-color: white;">
        <div class="center-align" style="margin-top: 200px"><img src="assets/images/loading.gif" style="width: 30px; height: auto; "></div>
        <div class="center-align">Loading...</div>
    </div>

    <main>
        <div class="container-fluid">
            <div data-ui-view  style="height:100%"></div>
        </div>
    </main>

    <footer class="footer navbar-fixed-bottom container-fluid hidden-print">
        <div class="row">
            <div class="col-xs-12 copyright">
               <span class="pull-right">{{versionStatement}}</span>
            </div>
        </div>
    </footer>
    <script src="bower_components/ckeditor/ckeditor.js"></script>

    <!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-XXXXX-X');
      ga('send', 'pageview');
    </script>

    <!--[if lt IE 9]>
    <script src="bower_components/es5-shim/es5-shim.js"></script>
    <script src="bower_components/json3/lib/json3.min.js"></script>
    <![endif]-->
    <!-- build:js({client,node_modules}) app/vendor.js -->
      <!-- bower:js -->
      <script src="bower_components/jquery/dist/jquery.js"></script>
      <script src="bower_components/angular/angular.js"></script>
      <script src="bower_components/json3/lib/json3.js"></script>
      <script src="bower_components/angular-resource/angular-resource.js"></script>
      <script src="bower_components/angular-cookies/angular-cookies.js"></script>
      <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
      <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
      <script src="bower_components/lodash/dist/lodash.compat.js"></script>
      <script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
      <script src="bower_components/jquery-ui/jquery-ui.js"></script>
      <script src="bower_components/angular-ui-date/src/date.js"></script>
      <script src="bower_components/angular-breadcrumb/release/angular-breadcrumb.js"></script>
      <script src="bower_components/angular-elastic/elastic.js"></script>
      <!-- endbower -->
    <!-- endbuild -->

        <!-- build:js({.tmp,client}) app/app.js -->
        <script src="app/app.js"></script>
          <!-- injector:js -->
          <script src="app/assignment-meeting/prepare-senior/candidate-list/candidates-list-controller.js"></script>
          <script src="app/assignment-meeting/prepare-senior/candidate/_candidate-ctrl.js"></script>
          <script src="app/assignment-meeting/prepare-senior/candidate/profile/_profile-ctrl.js"></script>
          <script src="app/assignment-meeting/prepare-senior/candidate/summary/_summary-ctrl.js"></script>
          <script src="app/home/home-controller.js"></script>
          <script src="app/routes.js"></script>
          <script src="components/auth/User.js"></script>
          <script src="components/auth/user-service.js"></script>
          <script src="components/directives/napi-ck-editor.js"></script>
          <script src="components/services/candidate-services.js"></script>
          <script src="components/services/http-helper.js"></script>
          <script src="components/services/menu-services.js"></script>
          <!-- endinjector -->
        <!-- endbuild -->
</body>
</html>
mpint commented 9 years ago

I'm having a similar issue with 'grunt serve' not finding files that are in bower_components, namely ng-file-upload and papaparse

JaKXz commented 9 years ago

@QuietOmen if you think it's an issue with line endings, do you have EditorConfig installed? Unfortunately I haven't seen this issue so I'm not much help otherwise.

Awk34 commented 9 years ago

+1, I've been seeing this too. I've been using Webstorm 8, and just upgraded to Webstorm 9, which integrates EditorConfig. @JaKXz If you think it's line endings, what can be done to fix it? (other than disabling EditorConfig of course :D )

BryceHayden commented 9 years ago

@JaKXz hmm I totally forgot about the EditorConfig file...so that means it most likely isn't the line endings....unless the editor config settings aren't applied when using grunt build. I'm still looking into this though as this problem has brought our team's productivity to a crawl whenever the index page gets updated as it causes all sorts of strange error before we realize we need to delete the index.html file and add the old one back in. When I use Beyond Compare the only difference I'm see between the files is still just the line ending though so this has me stumped.

BryceHayden commented 9 years ago

So for clarification here's my EditorConfig file:

# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

And here's a comparison of the two files in HEX. The one on the left is what I use to replace the index.html file I receive whenever I do a git pull:

lineendingproblem

As you can see the only difference I notice is the 0D line endings. So do I need to change my EditorConfig file to stop this from happening?

JaKXz commented 9 years ago

Apologies for the late response @QuietOmen, have you had any luck? This article about line endings from GitHub might help - otherwise I'm really not sure, sorry.

BryceHayden commented 9 years ago

That's OK, this time of year is busy for everyone. I removed the injector tags for now instead of addressing the issue, as I have other items that have a higher priority. I'll read up on the article that you posted when I get a second, and post a comment if I figure anything else out about the issue.

tkhelifiT commented 9 years ago

probably remove the base href="/" from your index.html