Grunt Uglify任务错误-无法读取未定义的属性'indexOf'

时间:2019-12-31 04:35:49

标签: java gruntjs uglifyjs

我正在本地设置项目。一切都会好起来,直到我开始咕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;
  • 所有这些都在运行mojave的本地计算机mac上。
  • 节点版本-8.11.0(项目要求使用该版本)
  • npm版本-6.9(项目要求使用该版本)
  • grunt版本1.04

我在这里不知所措。如果我有什么可以帮助更多有经验的人的,请告诉我。

0 个答案:

没有答案