我正在本地设置项目。一切都会好起来,直到我开始咕gr咕。
由于以下错误而停止:
Running "uglify:build" (uglify) task
Warning: Cannot read property 'indexOf' of undefined Use --force to continue.
打开-stacktrace
发出咕unt声之后,它确实输出了几个文件,但是我相信第一个是问题。我已经从错误中复制了特定的部分。
// Process specified wildcard glob patterns or filenames against a
// callback, excluding and uniquing files in the result set.
var processPatterns = function(patterns, fn) {
// Filepaths to return.
var result = [];
// Iterate over flattened patterns array.
grunt.util._.flattenDeep(patterns).forEach(function(pattern) {
// If the first character is ! it should be omitted
var exclusion = pattern.indexOf('!') === 0;
// If the pattern is an exclusion, remove the !
if (exclusion) { pattern = pattern.slice(1); }
// Find all matching files for this pattern.
var matches = fn(pattern);
if (exclusion) {
// If an exclusion, remove matching files.
result = grunt.util._.difference(result, matches);
} else {
// Otherwise add matching files.
result = grunt.util._.union(result, matches);
}
});
return result;
};
这是给我错误undefined indexOf
的地方:
var exclusion = pattern.indexOf('!') === 0;
我在这里不知所措。如果我有什么可以帮助更多有经验的人的,请告诉我。