什么是“验证属性___存在于配置”是什么意思? [英] What does "Verifying property ___ exists in config" mean in Grunt?

查看:348
本文介绍了什么是“验证属性___存在于配置”是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Gruntfile写在Coffeescript:

I have a simple Gruntfile written in Coffeescript:

"use strict"

module.exports = (grunt) ->

    config =
        src: "app"
        dist: "build"

    grunt.initConfig =
        config: config
        copy:
            dist:
                files: [
                    expand: true
                    cwd: "<%= config.app %>"
                    dest: "<%= config.dist %>"
                    src: [
                        "*.{ico,png}"
                        "{*/}*.html"
                    ]
                ]

    grunt.loadNpmTasks "grunt-contrib-copy"

    grunt.registerTask "build", [
        "copy:dist"
    ]

    grunt.registerTask "default", [
        "build"
    ]

运行时出现以下错误:

Verifying property copy.dist exists in config...ERROR
>> Unable to process task.
Warning: Required config property "copy.dist" missing. Use --force to continue.

这也是指什么?看起来copy.dist是存在的,为什么它不被读取?

What is this referring too? It seems like copy.dist is present, so why is it not being read?

此外,我假设这是一个Coffeescript格式问题,因为用Javascript编写的等效Gruntfile不会抛出此问题:

Also, I assume this is a Coffeescript formatting issue because the equivalent Gruntfile written in Javascript doesn't throw this issue:

"use strict";

module.exports = function (grunt) {

    // Configurable paths
    var config = {
        scr: "app",
        dist: "build"
    }

    grunt.initConfig({

        // Project settings
        config: config,

        copy: {
            dist: {
                files: [{
                    expand: true,
                    cwd: "<%= config.app %>",
                    dest: "<%= config.dist %>",
                    src: [
                        "*.{ico,png}",
                        "{*/}*.html"
                    ]
                }]
            }
        }
    });

    // Install plugins
    grunt.loadNpmTasks("grunt-contrib-copy");

    grunt.registerTask("build", [
        "copy:dist"
    ]);

    grunt.registerTask("default", [
        "build"
    ]);

};


推荐答案

我看不到 .app 在配置块中,我只能看到config.src包含一个字符串(app)。

I can not see config.app in your config block, I only can see config.src which contains a string ("app").

所以我会尝试将 cwd:<%= config.app%>切换到 cwd :<%= config.src%>

So I would try to swap cwd: "<%= config.app %>" to cwd: "<%= config.src %>".

希望会有所帮助。

这篇关于什么是“验证属性___存在于配置”是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆