node.js - Grunt - npm module not found -
i'm new grunt , i'm having trouble setting project new plugins.
so far have:
- installed grunt-cli globally
- installed grunt-init globally
- downloaded gruntfile template git repository
- created new directory 'test' , navigated directory in terminal
- created new grunt project template (grunt-init gruntfile)
- installed project dependencies (npm install)
this works great, want use different uglify plugin so, still in 'test' directory, run:
npm install uglify-js --save-dev
as i'm not using global flag, plugin downloads test/node_modules directory expected, existing @ test/node_modules/uglify-js. package.json file has been updated additional dependency:
"uglify-js": "^2.4.15"
i edit gruntfile.js, adding
grunt.loadnpmtasks('uglify-js');
and change
grunt.registertask('default', ['jshint', 'qunit', 'concat', 'uglify']);
to
grunt.registertask('default', ['concat', 'uglify-js']);
i run
npm install
to ensure dependencies downloaded, when run grunt task error:
local npm module "uglify-js" not found. installed? warning: task "uglify-js" not found. use --force continue.
anyone have idea i'm doing wrong?
mac os x 10.8.5, node v0.10.32
if want use uglifyjs whit grunt, should use grunt-contrib-uglify. install with:
npm install grunt-contrib-uglify --save-dev
enable inside gruntfile.js
:
grunt.loadnpmtasks('grunt-contrib-uglify');
and run task:
grunt uglify
see docs more information.
Comments
Post a Comment