sagar-ganatra / angular-require-template

Creating a template for Angular project; it uses RequireJS to get the module and other dependencies.
3 stars 0 forks source link

ngAnnotate fails on build #1

Open ElliotPsyIT opened 9 years ago

ElliotPsyIT commented 9 years ago

I was persuaded by your novel but quite intuitive angular project architecture (http://java.dzone.com/articles/improvising-angular-require) to give this starter project a try.

When running the default gulp to build the app, the process failed apparently from a ngAnnotate parsing error. I also noticed a OptionParser::InvalidOption error for 'style's, though I don't know its significance. I'm a relative newbie, so I don't know how to troubleshoot this particular error. I provide the backtrace for your review. Any assistance would be greatly appreciated!

[10:49:59] Finished 'jshint' after 17 s
[10:49:59] Starting 'styles'...
[10:50:00] OptionParser::InvalidOption: invalid option: --sourcemap=none
  Use --trace for backtrace.
[10:50:01] Finished 'styles' after 1.06 s
[10:50:01] Starting 'compresscss'...
[10:50:01] Finished 'compresscss' after 4.27 ms
[10:50:01] Starting 'ngAnnotate'...

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: bower_components/jquery/src/intro.js: error: couldn't process source due to parse error
Unexpected token (45:0)
    at transform (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp-ng-annotate/index.js:20:11)
    at Transform._transform (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp-ng-annotate/index.js:68:25)
    at Transform._read (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp-ng-annotate/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at Transform._write (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp-ng-annotate/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp-ng-annotate/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp-ng-annotate/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at Transform.Writable.write (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp-ng-annotate/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at write (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (/Users/ElliotFielstein/Angular/angular-require-template/src/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:664:5)
sagar-ganatra commented 9 years ago

Thanks for giving this template a try, I'm going to make another major improvement on gulp very soon (over the weekend). However, this looks like sass installation issue. The 'styles' task, uses ruby sass to compile the sass/scss files. Can you install latest compass which I believe will also install sass as well. Let me know if that works for you. You can uninstall compass and sass before installing the latest version.

sagar-ganatra commented 9 years ago

Also, I'm not sure why ngAnnotate is throwing an error. Can you do a clean bower install again and see if that fixes this issue.

ElliotPsyIT commented 9 years ago

Here's the clean bower install I did after cloning the template. I can certainly do another bower install if you think it necessary:

bower install
bower normalize-scss#~3.0.2 not-cached git://github.com/appleboy/normalize.scss.git#~3.0.2
bower normalize-scss#~3.0.2    resolve git://github.com/appleboy/normalize.scss.git#~3.0.2
bower angular-messages#~1.3.14       not-cached git://github.com/angular/bower-angular-messages.git#~1.3.14
bower angular-messages#~1.3.14          resolve git://github.com/angular/bower-angular-messages.git#~1.3.14
bower requirejs#~2.1.16              not-cached git://github.com/jrburke/requirejs-bower.git#~2.1.16
bower requirejs#~2.1.16                 resolve git://github.com/jrburke/requirejs-bower.git#~2.1.16
bower lumx#~0.3.20                   not-cached git://github.com/lumapps/lumX.git#~0.3.20
bower lumx#~0.3.20                      resolve git://github.com/lumapps/lumX.git#~0.3.20
bower angular-ui-router#~0.2.13          cached git://github.com/angular-ui/ui-router.git#0.2.13
bower angular-ui-router#~0.2.13        validate 0.2.13 against git://github.com/angular-ui/ui-router.git#~0.2.13
bower angular-cookies#~1.3.14            cached git://github.com/angular/bower-angular-cookies.git#1.3.15
bower angular-cookies#~1.3.14          validate 1.3.15 against git://github.com/angular/bower-angular-cookies.git#~1.3.14
bower jquery#~2.1.3                      cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#~2.1.3                    validate 2.1.3 against git://github.com/jquery/jquery.git#~2.1.3
bower angular-mocks#~1.3.14              cached git://github.com/angular/bower-angular-mocks.git#1.3.15
bower angular-mocks#~1.3.14            validate 1.3.15 against git://github.com/angular/bower-angular-mocks.git#~1.3.14
bower angular#~1.3.14                    cached git://github.com/angular/bower-angular.git#1.3.15
bower angular#~1.3.14                  validate 1.3.15 against git://github.com/angular/bower-angular.git#~1.3.14
bower requirejs#~2.1.16                download https://github.com/jrburke/requirejs-bower/archive/2.1.18.tar.gz
bower normalize-scss#~3.0.2            download https://github.com/appleboy/normalize.scss/archive/3.0.3.tar.gz
bower lumx#~0.3.20                     download https://github.com/lumapps/lumX/archive/v0.3.35.tar.gz
bower angular-ui-router#~0.2.13             new version for git://github.com/angular-ui/ui-router.git#~0.2.13
bower angular-ui-router#~0.2.13         resolve git://github.com/angular-ui/ui-router.git#~0.2.13
bower angular-ui-router#~0.2.13        download https://github.com/angular-ui/ui-router/archive/0.2.15.tar.gz
bower angular-messages#~1.3.14         download https://github.com/angular/bower-angular-messages/archive/v1.3.15.tar.gz
bower jquery#~2.1.3                         new version for git://github.com/jquery/jquery.git#~2.1.3
bower jquery#~2.1.3                     resolve git://github.com/jquery/jquery.git#~2.1.3
bower jquery#~2.1.3                    download https://github.com/jquery/jquery/archive/2.1.4.tar.gz
bower normalize-scss#~3.0.2             extract archive.tar.gz
bower requirejs#~2.1.16                 extract archive.tar.gz
bower normalize-scss#~3.0.2            resolved git://github.com/appleboy/normalize.scss.git#3.0.3
bower requirejs#~2.1.16            invalid-meta requirejs is missing "ignore" entry in bower.json
bower requirejs#~2.1.16                resolved git://github.com/jrburke/requirejs-bower.git#2.1.18
bower angular-messages#~1.3.14          extract archive.tar.gz
bower angular-messages#~1.3.14         resolved git://github.com/angular/bower-angular-messages.git#1.3.15
bower angular-ui-router#~0.2.13         extract archive.tar.gz
bower angular-ui-router#~0.2.13        resolved git://github.com/angular-ui/ui-router.git#0.2.15
bower lumx#~0.3.20                      extract archive.tar.gz
bower lumx#~0.3.20                     mismatch Version declared in the json (0.0.0) is different than the resolved one (0.3.35)
bower lumx#~0.3.20                     resolved git://github.com/lumapps/lumX.git#0.3.35
bower jquery#*                           cached git://github.com/jquery/jquery.git#2.1.3
bower jquery#*                         validate 2.1.3 against git://github.com/jquery/jquery.git#*
bower jquery#*                              new version for git://github.com/jquery/jquery.git#*
bower jquery#*                          resolve git://github.com/jquery/jquery.git#*
bower jquery#*                         download https://github.com/jquery/jquery/archive/2.1.4.tar.gz
bower bourbon#*                      not-cached git://github.com/thoughtbot/bourbon.git#*
bower bourbon#*                         resolve git://github.com/thoughtbot/bourbon.git#*
bower moment#*                           cached git://github.com/moment/moment.git#2.8.4
bower moment#*                         validate 2.8.4 against git://github.com/moment/moment.git#*
bower mdi#1.0.8-beta                 not-cached git://github.com/Templarian/MaterialDesign-Webfont.git#1.0.8-beta
bower mdi#1.0.8-beta                    resolve git://github.com/Templarian/MaterialDesign-Webfont.git#1.0.8-beta
bower velocity#*                     not-cached git://github.com/julianshapiro/velocity.git#*
bower velocity#*                        resolve git://github.com/julianshapiro/velocity.git#*
bower mdi#1.0.8-beta                   download https://github.com/Templarian/MaterialDesign-Webfont/archive/v1.0.8-beta.tar.gz
bower velocity#*                       download https://github.com/julianshapiro/velocity/archive/1.2.2.tar.gz
bower bourbon#*                        download https://github.com/thoughtbot/bourbon/archive/v4.2.3.tar.gz
bower jquery#~2.1.3                     extract archive.tar.gz
bower moment#*                              new version for git://github.com/moment/moment.git#*
bower moment#*                          resolve git://github.com/moment/moment.git#*
bower moment#*                         download https://github.com/moment/moment/archive/2.10.3.tar.gz
bower jquery#~2.1.3                    resolved git://github.com/jquery/jquery.git#2.1.4
bower bourbon#*                         extract archive.tar.gz
bower jquery#*                          extract archive.tar.gz
bower bourbon#*                        resolved git://github.com/thoughtbot/bourbon.git#4.2.3
bower jquery#*                         resolved git://github.com/jquery/jquery.git#2.1.4
bower velocity#*                        extract archive.tar.gz
bower velocity#*                       resolved git://github.com/julianshapiro/velocity.git#1.2.2
bower mdi#1.0.8-beta                    extract archive.tar.gz
bower mdi#1.0.8-beta                   resolved git://github.com/Templarian/MaterialDesign-Webfont.git#1.0.8-beta
bower moment#*                          extract archive.tar.gz
bower moment#*                         resolved git://github.com/moment/moment.git#2.10.3
bower angular-cookies#~1.3.14           install angular-cookies#1.3.15
bower angular#~1.3.14                   install angular#1.3.15
bower angular-mocks#~1.3.14             install angular-mocks#1.3.15
bower normalize-scss#~3.0.2             install normalize-scss#3.0.3
bower requirejs#~2.1.16                 install requirejs#2.1.18
bower angular-messages#~1.3.14          install angular-messages#1.3.15
bower angular-ui-router#~0.2.13         install angular-ui-router#0.2.15
bower lumx#~0.3.20                      install lumx#0.3.35
bower jquery#~2.1.3                     install jquery#2.1.4
bower bourbon#*                         install bourbon#4.2.3
bower velocity#*                        install velocity#1.2.2
bower mdi#1.0.8-beta                    install mdi#1.0.8-beta
bower moment#*                          install moment#2.10.3
ElliotPsyIT commented 9 years ago

And here are the currently installed versions of compass Compass 0.12.2 (Alnilam) and sass Sass 3.2.1 (Media Mark).

ElliotPsyIT commented 9 years ago

I have clean installed Compass Compass 1.0.3 (Polaris) and SASS Sass 3.4.14 (Selective Steve). Now gulp fails with this error:

[14:55:24] Finished 'jshint' after 15 s
[14:55:24] Starting 'styles'...
[14:55:25] Error: File to import not found or unreadable: ../vendor/normalize-scss/_normalize.scss.
        on line 1 of styles/app.scss
  Use --trace for backtrace.

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: Broken @import declaration of "../vendor/lumx/_colors.scss", Broken @import declaration of "../vendor/lumx/_lumx.scss"
sagar-ganatra commented 9 years ago

I think the vendor directory is not present and that's because bower-installer has not been run. Can you run bower-installer and then run gulp. I'm making major changes to the gulp build, making it more cleaner, please bare with me and wait till Monday. I'll also document the steps required for installation soon.

ElliotPsyIT commented 9 years ago

No problem. I'm happy to be a guinea pig :) I installed and then ran bower-installer and got this error. As you can see, it's a problem with the location of bower_components directory. In my installation that directory is under app and not under src. I may have run bower install from the wrong directory. Ok, I guess I'll wait til next week to get directions on installation.

ElliotFielstein$ bower-installer
Setting up install paths...Finished
Running bower install...Finished
Installing: 
/usr/local/lib/node_modules/bower-installer/node_modules/bower/node_modules/q/q.js:126
                    throw e;
                          ^
Error: ENOENT, no such file or directory '/Users/ElliotFielstein/Angular/angular-require-template/src/bower_components/lumx/dist/scss/settings/_colors.scss'
    at Error (native)
    at Object.fs.lstatSync (fs.js:792:18)
    at installFile (/usr/local/lib/node_modules/bower-installer/lib/installer.js:84:11)
    at /usr/local/lib/node_modules/bower-installer/lib/installer.js:166:13
    at /usr/local/lib/node_modules/bower-installer/node_modules/async/lib/async.js:111:13
    at Array.forEach (native)
    at _each (/usr/local/lib/node_modules/bower-installer/node_modules/async/lib/async.js:32:24)
    at Object.async.each (/usr/local/lib/node_modules/bower-installer/node_modules/async/lib/async.js:110:9)
    at Object.installDependency (/usr/local/lib/node_modules/bower-installer/lib/installer.js:159:11)
    at /usr/local/lib/node_modules/bower-installer/bower-installer.js:140:31
sagar-ganatra commented 9 years ago

If you have moved the directories then the references should be updated. I have now made a change wherein there are multiple build script files that would run when run the gulp command. Also, now the files would be downloaded to .tmp directory and then installed in bower_components directory using bower-installer. You need not run bower-installer manually, it would be called by when you run bower install (post install option in .bowerrc)

If you see any issues with bower or npm package installations delete the .tmp and node_modules directory again and then try.