在问这个问题之前,我已经看过很多不同的帖子了,但是我无法通过这个错误"Uglify“。
我下载了node.js,uglfy.js。我很快就跟随了这里的所有步骤。How to install grunt and how to build script with it
我的Gruntjs文件:
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
src: 'js/global.js',
dest: 'js/build/global.min.js'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['uglify']);
};和package.json:
{
"name": "contentImageSlider",
"version": "0.1.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.3.3",
"grunt-contrib-uglify": "~0.4.0"
},
"description": "slider",
"main": "Gruntfile.js",
"dependencies": {
"grunt": "^0.4.5"
},
"scripts": {
"test": "test"
},
"repository": {
"type": "git",
"url": "https://github.com/haldunatar/contentImageSlider.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/haldunatar/contentImageSlider/issues"
},
"homepage": "https://github.com/haldunatar/contentImageSlider"
}错误:
Local Npm module "grunt-contrib-uglify" not found. is it installed?
Warning:Tast 'uglify' not found. use --force to continue.
Aborted due to warnings.所以每次当我输入“咕噜”时,它就会显示出我下载的error..but uglify.js。
这里有人能帮我吗?
提前感谢!
发布于 2014-05-28 20:06:16
我看到package.json文件中有“grunt-contrib”,但是错误表明它没有安装。也许您最近添加了依赖项,但没有执行npm install?尝试从根目录运行npm install,然后重新运行grunt。
https://stackoverflow.com/questions/23918970
复制相似问题