gruntjs - Cannot get grunt to perform uglify -
i'm using grunt , trying uglify js file produced concat task. concat works fine, uglify fails following error.
running "uglify:dist" (uglify) task >> uglifying source "dist/myapp.js" failed. warning: uglification failed. used --force, continuing. warning: cannot read property 'min' of undefined used --force, continuing.
node --version
outputs v.0.11.8-pre
grunt --version
outputs grunt-cli v0.1.9 grunt v.0.4.1
here gruntfile.js
. copied documentation , removed tasks don't need.
module.exports = function(grunt) { grunt.initconfig({ pkg: grunt.file.readjson('package.json'), concat: { options: { separator: ';' }, dist: { src: ['src/**/*.js'], dest: 'dist/<%= pkg.name %>.js' } }, uglify: { options: { banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n' }, dist: { files: { 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] } } } }); grunt.loadnpmtasks('grunt-contrib-concat'); grunt.loadnpmtasks('grunt-contrib-uglify'); grunt.registertask('default', ['concat', 'uglify']); };
i ran sudo npm install xxx --save-dev
grunt
, grunt-contrib-concat
, , grunt-contrib-uglify
in project directory. project directory looks this.
. ├─── src | └─── // bunch of files/dirs here ├─── dist ├─── node_modules ├─── .git ├─── package.json └─── gruntfile.js
here output running grunt --verbose --stack --debug
running "uglify:dist" (uglify) task [d] task source: /home/cookiemon/dropbox/projects/myapp/node_modules/grunt-contrib-uglify/tasks/uglify.js verifying property uglify.dist exists in config...ok files: dist/myapp.js -> dist/myapp.min.js minifying uglifyjs...>> uglifying source "dist/myapp.js" failed. warning: uglification failed. use --force continue. typeerror: object #<object> has no method 'outputstream' @ object.exports.minify (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt-contrib-uglify/tasks/lib/uglify.js:30:27) @ /home/cookiemon/dropbox/projects/myapp/node_modules/grunt-contrib-uglify/tasks/uglify.js:85:25 @ array.foreach (native) @ object.<anonymous> (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt-contrib-uglify/tasks/uglify.js:36:16) @ object.<anonymous> (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt/lib/grunt/task.js:258:15) @ object.thistask.fn (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt/lib/grunt/task.js:78:16) @ object.<anonymous> (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt/lib/util/task.js:282:30) @ task.runtaskfn (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt/lib/util/task.js:235:24) @ task.<anonymous> (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt/lib/util/task.js:281:12) @ task.<anonymous> (/home/cookiemon/dropbox/projects/myapp/node_modules/grunt/lib/util/task.js:215:7) aborted due warnings.
at point, have no idea missed. me out?
i solved problem. downgrading nodejs v0.10.20
fixed it.
Comments
Post a Comment