uglify js错误。意外的令牌:eof(未定义)

时间:2016-05-02 10:20:52

标签: javascript angularjs gulp uglifyjs

我一直收到一个意外的令牌错误,我似乎无法找出原因。我正在使用uglifyJS和grunt-contrib-uglify任务,但我也使用命令行获取错误。

Using gulpfile c:\path\to\gulpfile.js
[14:05:53] Starting 'build'...
[14:05:53] Starting 'clean:build'...
[14:05:53] Finished 'clean:build' after 30 ms
[14:05:53] Starting 'sass:build'...
[14:05:56] Finished 'sass:build' after 2.52 s
[14:05:56] Starting 'images'...
[14:06:03] gulp-imagemin: Minified 3 images (saved 38.69 kB - 18.2%)
[14:06:03] Finished 'images' after 7.47 s
[14:06:03] Starting 'templates'...
[14:06:15] Finished 'templates' after 12 s
[14:06:15] Starting 'usemin'...
[14:06:30] { [Error: c:\path\to\assets\js\controller.js: Unexpected token: eof (undefined)]
  message: 'c:\\path\to\\assets\\js\\controller.js: Unexpected token: eof (undefined)',
  fileName: 'c:\\path\to\\assets\\js\\controller.js',
  lineNumber: 437,
  stack: 'Error\n    at new JS_Parse_Error (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1526:18)\n    at js_error (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:1534:11)\n    at croak (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2026:9)\n    at token_error (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2034:9)\n    at unexpected (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2040:9)\n    at block_ (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2352:28)\n    at eval (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2326:25)\n    at function_ (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2331:15)\n    at expr_atom (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2546:24)\n    at maybe_unary (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2716:19)\n    at expr_ops (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2751:24)\n    at maybe_conditional (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2756:20)\n    at maybe_assign (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2780:20)\n    at maybe_assign (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2788:32)\n    at expression (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2799:20)\n    at simple_statement (eval at <anonymous> (c:\\path\to\\node_modules\\uglify-js\\tools\\node.js:22:1), <anonymous>:2240:55)',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-uglify' }

Process finished with exit code 0

我检查了第437行,但我找不到错误。

$interval(function () {
    angular.forEach($scope.toDeleteEvent, function (time, eventId) {
        if($scope._events[eventId] && $scope._events[eventId].state > 1 && new Date().getTime() - time) {
            delete $scope.toDeleteEvent[eventId];
// this is a 437 line...
            $scope.deleteEvent($scope.idsByEvent[eventId].sport, $scope.idsByEvent[eventId].country, $scope.idsByEvent[eventId].league, eventId);
        }
    });
}, 300000);

你们有没有遇到同样的错误?

0 个答案:

没有答案