首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让Grunt工作..?

如何让Grunt工作..?
EN

Stack Overflow用户
提问于 2014-05-28 18:14:51
回答 1查看 183关注 0票数 0

在问这个问题之前,我已经看过很多不同的帖子了,但是我无法通过这个错误"Uglify“。

我下载了node.js,uglfy.js。我很快就跟随了这里的所有步骤。How to install grunt and how to build script with it

我的Gruntjs文件:

代码语言:javascript
复制
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:

代码语言:javascript
复制
{
    "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"
}

错误:

代码语言:javascript
复制
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。

这里有人能帮我吗?

提前感谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-28 20:06:16

我看到package.json文件中有“grunt-contrib”,但是错误表明它没有安装。也许您最近添加了依赖项,但没有执行npm install?尝试从根目录运行npm install,然后重新运行grunt

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23918970

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档