我正在尝试使用Grunt构建我的angularjs应用程序,但似乎挂了ng-annotate。我正在使用npm版本2.6.0并完成npm install --save-dev
和npm install -g
并且还尝试更新我的ng-annotate和grunt-ng-annotate引用以及更新我的所有bower包。任何人遇到此错误(如下)?
grunt build命令:
$ grunt build
Running "clean:dist" (clean) task
Cleaning .tmp...OK
Running "wiredep:app" (wiredep) task
Running "bower:app" (bower) task
Updated RequireJS config with installed Bower components
Running "replace:test" (replace) task
Running "useminPrepare:html" (useminPrepare) task
Configuration changed for concat, uglify, cssmin
Running "concurrent:dist" (concurrent) task
Running "svgmin:dist" (svgmin) task
Total saved: 0 B
Done, without errors.
Running "copy:styles" (copy) task
Copied 1 files
Done, without errors.
Running "imagemin:dist" (imagemin) task
Minified 0 images (saved 0 B)
Done, without errors.
Running "autoprefixer:dist" (autoprefixer) task
File .tmp/styles/main.css created.
Running "concat:generated" (concat) task
File .tmp\concat\styles\vendor.css created.
File .tmp\concat\styles\main.css created.
Running "ngAnnotate:dist" (ngAnnotate) task
Generating ".tmp/analyst_workbench/bower_components/jquery/src/intro.js" from: "
my_app_name/bower_components/jquery/src/intro.js"...ERROR
>> error: couldn't process source due to parse error
>> Unexpected token (45:0)
Generating ".tmp/analyst_workbench/bower_components/jquery/src/outro.js" from: "
my_app_name/bower_components/jquery/src/outro.js"...ERROR
>> error: couldn't process source due to parse error
>> Unexpected token (1:0)
Warning: Task "ngAnnotate:dist" failed. Use --force to continue.
Aborted due to warnings.
Execution Time (2015-02-23 16:31:18 UTC)
clean:dist 172ms ■ 1%
wiredep:app 273ms ■ 2%
bower:app 1.3s ■■■■ 8%
concurrent:dist 9.8s ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 66%
ngAnnotate:dist 3.3s ■■■■■■■■■■ 22%
Total 14.9s
Grunt.js ng-annotate部分:
// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
dist: {
files: [{
expand: true,
//cwd: '<%= yeoman.app %>/<%= yeoman.components %>',
src: ['<%= yeoman.app %>/<%= yeoman.components %>/**/*.js', '!<%= yeoman.app %>/<%= yeoman.components %>/oldieshim.js'],
dest: '.tmp'
}]
}
},
编辑:奥洛夫在这里回答了我的问题。 https://github.com/olov/ng-annotate/issues/143