[英]gulp-jscs Object.keys called on non-object
I'm a novice at gulp, and trying to play with it. 我是gulp的新手,并尝试使用它。 I get this error when I try to use
gulp-jscs
当我尝试使用
gulp-jscs
时出现此错误
'default' errored after 98 ms
[16:58:00] TypeError: Object.keys called on non-object
at Function.keys (native)
at NodeConfiguration.Configuration._throwNonCamelCaseErrorIfNeeded (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:440:12)
at NodeConfiguration.Configuration.load (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:51:10)
at StringChecker.configure (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/string-checker.js:66:29)
at Checker.configure (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/checker.js:26:39)
at module.exports (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/index.js:31:11)
at Gulp.<anonymous> (/home/kbadr/Node_Projects/demo/membership/gulpfile.js:22:15)
at module.exports (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp/node_modules/orchestrator/index.js:214:10
and here's my gulpfile
这是我的
gulpfile
var gulp = require('gulp');
var jscs = require('gulp-jscs');
gulp.task('default', function () {
return gulp.src('src/app.js')
.pipe(jscs());
});
This seems to happen if jscs doesn't have read access to your .jscsrc or if it doesn't exist. 如果jscs没有对.jscsrc的读访问权限或者它不存在,这似乎就会发生。 This happened to me after copying and pasting it from an old git repro.
这是在我从一个旧的git repro复制并粘贴之后发生的。 To fix this open the file with a text editor and resave it, accepting the prompt to overwrite as well as starting with a '.'
要解决此问题,请使用文本编辑器打开文件并重新保存,接受覆盖提示以及以“。”开头。 (eg .jscsrc) Run your task again and it will complete.
(例如.jscsrc)再次运行您的任务,它将完成。
I had the same problem: "Unable to load JSCS config file at /Desktop/node/My_Project_Name/.jscsrc Unexpected end of input...." 我有同样的问题:“无法在/Desktop/node/My_Project_Name/.jscsrc加载JSCS配置文件意外的输入结束....”
I was able to solve the problem by first checking to see if the file existed in the root of my project. 我能够通过首先检查文件是否存在于项目的根目录中来解决问题。 in terminal run this command: ls -ld .?*
在终端运行此命令: ls -ld。?*
The file was never created for me so I created the .jscsrc file then I added the following code: 该文件从未为我创建,因此我创建了.jscsrc文件,然后添加了以下代码:
{
"excludeFiles": ["node_modules/**", "bower_components/**"],
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireOperatorBeforeLineBreak": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"maximumLineLength": {
"value": 100,
"allowComments": true,
"allowRegex": true
},
"validateIndentation": 4,
"validateQuoteMarks": "'",
"disallowMultipleLineStrings": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowMultipleVarDecl": null,
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBinaryOperators": [
"=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
"&=", "|=", "^=", "+=",
"+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
"|", "^", "&&", "||", "===", "==", ">=",
"<=", "<", ">", "!=", "!=="
],
"requireSpaceAfterBinaryOperators": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeBlockStatements": true,
"requireLineFeedAtFileEnd": true,
"disallowSpacesInsideObjectBrackets": "all",
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideParentheses": true,
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
},
"disallowMultipleLineBreaks": true,
"disallowCommaBeforeLineBreak": null,
"disallowDanglingUnderscores": null,
"disallowEmptyBlocks": null,
"disallowMultipleLineStrings": null,
"disallowTrailingComma": null,
"requireCommaBeforeLineBreak": null,
"requireDotNotation": null,
"requireMultipleVarDecl": null,
"requireParenthesesAroundIIFE": true
}
Save this file to the root of your project, then run the gulp task command again it should work. 将此文件保存到项目的根目录,然后再次运行gulp task命令它应该可以工作。
在ngCordova上更新了bower.json中的依赖项并解决了问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.