缺少咕噜声所需的配置属性
grunt required config property missing
设置一个新项目,该项目将有多个我想从任务文件加载的繁重任务。
在运行我的第一个任务"core"时,它应该为网站构建核心 css,我遇到了一个我似乎无法解决的错误。 一直在谷歌上搜索,但没有找到这个特定问题。 具有相同错误消息的任何问题通常是由于OP部分的拼写错误或大括号放错位置的结果。不确定这里的情况是否如此,但也许其他人看到了我显然没有看到的东西。
咕噜咕噜.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: require('./package.json')
});
grunt.loadTasks('grunt-tasks');
};
grunt-tasks/grunt-core.js
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-sass');
grunt.config('core', {
sass : {
options : {
sourceMap : true,
includePaths : 'node_modules/bootstrap-sass/assets/stylesheets'
},
dist : {
files : {
'main.css' : 'main.scss'
}
}
}
});
grunt.registerTask('core', ['sass:dist']);
};
错误:
$ grunt core
Running "sass:dist" (sass) task
Verifying property sass.dist exists in config...ERROR
>> Unable to process task.
Warning: Required config property "sass.dist" missing. Use --force to continue.
Aborted due to warnings.
我尝试了几种不同的东西。如果我将注册任务更改为:
grunt.registerTask('core', ['sass']);
我收到此错误:
$ grunt core
>> No "sass" targets found.
Warning: Task "sass" failed. Use --force to continue.
Aborted due to warnings.
不确定这是否相关,但这里是 package.json 和我正在使用的系统的一些规格。
Mac OSX Yosemite
node version v5.10.1
npm 3.8.3
包.json
{
"name": "TEST",
"version": "1.0.0",
"description": "test test test",
"main": "Gruntfile.js",
"scripts": {
"test": "echo '"Error: no test specified'" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/path/to/repo"
},
"author": "me <me@example.com>",
"license": "ISC",
"bugs": {
"url": "https://github.com/path/to/repo/issues"
},
"homepage": "https://github.com/path/to/repo",
"devDependencies": {
"angular": "^1.5.5",
"bootstrap-sass": "^3.3.6",
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-uglify": "^1.0.1",
"grunt-contrib-watch": "^1.0.0",
"grunt-sass": "^1.1.0",
"jquery": "^2.2.3",
"sass-lint": "^1.5.1"
},
"dependencies": {
"jquery": "^2.2.3"
}
}
看起来这是我的用户错误。
在任务文件中,我有grunt.config(),但我应该有grunt.initConfig()
var taskConfig = {
sass : {
options : {
sourceMap : true,
includePaths : 'node_modules/bootstrap-sass/assets/stylesheets'
},
dist : {
files : {
'main.css' : 'main.scss'
}
}
},
concat : {
core : {
src : ['node_modules/jquery/dist/jquery.js', 'js/main.js'],
dest : "../dev/js/main.js"
}
}
};
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-sass');
grunt.initConfig(taskConfig);
grunt.registerTask('core', ['concat:core','sass']);
};
相关文章:
- 断言属性不可配置
- 使用Javascript而不是html数据属性配置Parsley
- 为什么此可配置属性不可删除
- 缺少咕噜声所需的配置属性
- Sencha Touch Store配置属性仅在“__proto__”;
- 使用script元素上的html data-*属性来配置引用的脚本文件
- Magento 1.9.2-更新自定义属性'delivery_time'在可配置的产品过程中
- 如何更改 Javascript 对象属性的可写可枚举和可配置值
- TypeError: 属性 Array.prototype.splice.call(..) 是不可配置的,无法删除
- 递归 js v3 未捕获的类型错误:无法读取未定义的属性“配置”
- 通过函数填充 Grunt 任务配置的“文件”属性
- 在 JSON.parse() 之后保留属性属性(可写、可配置)
- PyQT4:“类型错误:尝试配置不可配置属性的可配置属性
- 类型错误:属性 1 不可配置,无法删除
- 使现有的不可写和不可配置属性可写和可配置
- 如何在ECMAScript 5: Object中配置属性.创建或定义对象属性
- 访问自定义ui-router配置属性中的$stateParams
- 如何在Extjs 6中给视图项配置属性
- 对象的可配置属性和可写属性的区别
- 我没有'无法理解对象的可写和可配置属性