uglify js error. Unexpected token: eof (undefined)

半世苍凉 提交于 2019-12-25 07:35:09

问题


I keep getting a Unexpected token error and I can't seem to figure out why. I am using uglifyJS with the grunt-contrib-uglify task but am also getting the error using the command line.

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

I checked line 437, but I can't find error.

$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);

Do any of you run into the same error?

来源:https://stackoverflow.com/questions/36980123/uglify-js-error-unexpected-token-eof-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!