config = sr-6ren">
gpt4 book ai didi

coffeescript - "Verifying property ___ exists in config"在 Grunt 中是什么意思?

转载 作者:行者123 更新时间:2023-12-04 04:17:28 25 4
gpt4 key购买 nike

我有一个用 Coffeescript 编写的简单 Gruntfile:

"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 存在,为什么没有被读取?

另外,我认为这是 Coffeescript 格式问题,因为用 Javascript 编写的等效 Gruntfile 不会引发此问题:
"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"
]);

};

最佳答案

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

所以我会尝试交换 cwd: "<%= config.app %>"cwd: "<%= config.src %>" .

希望这会有所帮助。

关于coffeescript - "Verifying property ___ exists in config"在 Grunt 中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26469127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com