An unexpected error event occurred while using gulp uglify

My current approach involves using gulp-uglify and gulp-concat to minify and concatenate my JavaScript files. The specific code for this process is outlined below:

gulp.task('scripts', function() {
    gulp.src([
            './development/assets/js/lib/jquery-1.11.2.min.js',
            './development/assets/js/lib/foundation.min.js',
            './development/assets/js/lib/angular.min.js',
            './development/assets/js/lib/angular.min.js.map',
            './development/assets/js/lib/angular-ui-router.min.js',
            './development/assets/js/lib/angular-animate.js',
            './development/assets/js/lib/angular-sanitize.min.js',
            './development/assets/js/lib/loading-bar.min.js',
            './development/assets/js/lib/angular-sanitize.min.js',
            './development/assets/js/lib/toastr.min.js',
            './development/assets/js/lib/angular-datepicker.js',
            './development/assets/js/lib/angucomplete-alt.js',
            './development/assets/js/lib/d3.v3.min.js',
            './development/assets/js/lib/mm-foundation.min.js',
            './development/assets/js/lib/ng-text-truncate.js',
            './development/assets/js/lib/angular-lazy-loader.min.js',
            './development/assets/js/lib/jquery-jvectormap-2.0.3.min.js',
            './development/assets/js/lib/jquery-jvectormap-world-mill.js',
            './development/assets/js/lib/jquery.tagcanvas.min.js',
            './development/assets/js/lib/angular-touch.min.js',
            './development/assets/js/lib/slick.min.js',
            './development/assets/js/lib/angular-slick.min.js',
            './development/assets/js/lib/d3.tip.js',
            './development/assets/js/lib/angular-pageslide-directive.js',
            './development/assets/js/app.js',
            './development/assets/js/lib/upload.js',
            './development/assets/js/controllers/**/*.js',
            './development/assets/js/services/**/*.js',
            './development/assets/js/filters/**/*.js',
            './development/assets/js/directives/**/*.js'
        ])
        .pipe(concat('production.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./production/assets'))
})

Upon running the gulp scripts command, I encounter an error. The following error stack trace is displayed:

events.js:85
          throw er; // Unhandled 'error' event
                ^
    Error
        at new JS_Parse_Error (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1526:18)
        at js_error (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:1534:11)
        at croak (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2025:9)
        at token_error (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2033:9)
        at unexpected (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2039:9)
        at semicolon (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2059:43)
        at simple_statement (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2239:73)
        at eval (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2092:47)
        at eval (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2072:24)
        at block_ (eval at <anonymous> (/home/project/static/node_modules/gulp-uglify/node_modules/uglify-js/tools/node.js:24:4), <anonymous>:2352:20)

I am seeking assistance in identifying the root cause of this issue. My Gulp version is 3.9.0, and the Node version is 0.12.7.

Answer №1

The problem was identified. It arose from the presence of the file

'./development/assets/js/lib/angular.min.js.map'
. The uglify tool is not compatible with map files.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Challenges with pjax/ajax and handling the browser's back button

I've implemented pjax to ajaxify my menu links, which works well until I encounter an issue with the browser back button. In my JavaScript file, I have both Common Script files (to load all necessary js files when the user hits the URL) and Script fil ...

Load distinctive javascript files that cater to the needs of the Code Igniter view

Struggling to come up with the most efficient way to load different javascript files in my CodeIgniter project. The issue at hand is that I have numerous CodeIgniter views, each needing specific javascript resources to function properly. How can I simpli ...

Creating React components through the use of the map function

Utilizing the hackernews api, I am attempting to extract the "data" property from my response object in order to display each story title individually on the browser. Initially, the data is structured as an array of id's representing individual storie ...

Implementing a dynamic like functionality using Ajax in Django

I've created a new structure for the like button, but it's not functioning correctly. Here are the files I'm working with: models.py class Comment(models.Model): title = models.CharField(max_length=50) author = models.ForeignKey(Pr ...

Insert information into an array within a mongoDB structure using the Mongoose library

Is it possible to add elements into an array in a mongoDB schema? For instance, in the given schema: var ProviderSchema = new Schema({ keyWords: [String] }); How can I insert data into the keyWords field using the specified route: app.put(&a ...

AngularJs input field with a dynamic ng-model for real-time data binding

Currently facing an issue with my static template on the render page. <form name="AddArticle" ng-submit="addArticle()" class="form add-article"> <input type="text" value="first" init-from-form ng-model="article.text[0]" /> <input typ ...

Increasing the maximum width of an image in CSS is necessary to see the max-height take effect

Within my HTML structure: <Col md="6"> <div className="hero-section"> <div className={`flipper ${isFlipping ? "isFlipping" : ""}`}> <div className="front"> <div className="hero-section-content"> ...

JSON - The challenge of incorporating single quotes within double quotes

In my current scenario, I am using the following code to populate form fields. The code is designed to handle a JSON dataset that has been encoded with PHP's json_encode function. Everything works smoothly when dealing with either single or double qu ...

The slides on SlickJS are initially loaded in a vertical alignment, but once the arrows are interacted with,

I've put together a demonstration that highlights the issue I'm facing. Upon visiting the contact section, you'll notice that all the slickJS slides are stacked vertically initially, but once you interact with them by clicking on the arrow o ...

Generating a text input field with multiple lines

<!DOCTYPE html> <html> <body> <p>Press the button to generate a File Upload Button.</p> <button onclick="myFunction()">Click here</button> <script> function myFunction() { var x = document.createElemen ...

Silent response upon click event listener

I'm having an issue with a navbar item not calling the reverseService function on click as expected. Although my IDE is indicating that the reverseService function is never used, VueJS dev tool doesn't show any problems. However, manually changi ...

Delete the element that was generated using jQuery

Is there a way to add and remove an overlay element using JavaScript? I am struggling to get JavaScript to remove an element that was created with JavaScript. Any suggestions? Check out this JS Fiddle example Here is the HTML code: <div id="backgroun ...

AngularJS uses variables defined by using curly braces like {{"message"}}

I am currently utilizing the following code snippet to monitor route changes: $scope.$on('$routeChangeStart', function (event, toState, toParams, fromState, fromParams) { //content $log.log(toState); } Whenever I print out "toState ...

How to resolve logic issues encountered during Jasmine testing with describe()?

I am encountering an issue while testing the following code snippet: https://i.sstatic.net/ImwLs.png dateUtility.tests.ts: import { checkDayTime } from "./dateUtility"; describe("utilities/dateUtility", () => { describe("ch ...

With jQuery's .text() method, it is possible to modify the first span's Bootstrap class, but not the

As someone who is new to javascript, html, and jquery, I have been trying to change the text of 2 span elements in the same div using jquery's .text() command. Despite going through various solutions provided by different questions, none seem to work ...

Modify text using JQuery when the span is clicked

Currently, I am attempting to retrieve a value from the database: SenderDriver->total_trips. Everything seems fine, but I have a specific id that needs to be placed within onClick(), which then sets the value of the database variable: SenderDriver-> ...

transferring information to a different application module (or page) through a double-click feature in AngularJS

Within my angularjs application, I am faced with a challenge involving two pages. The first page retrieves data from a database and displays it in a table. Upon double-clicking on a row, the user is directed to another page where more detailed informatio ...

Struggling to make dynamically created SVG 'use' elements function properly

SVG offers a unique system with symbol and use where icons can be defined once and reused throughout the SVG using use. However, I am having trouble getting it to work from JavaScript. You can view an example on this JSFiddle link. When programmatically ...

Error encountered in dynamically generating JSON due to an unterminated string literal

I am attempting to create a JSON variable to pass to a slideshow plugin. Here is the code found within the head section: <script type="text/javascript"> var photos = []; {% for service in company.services.all %} photos.push({ ...

Managing array elements in React: removing and duplicating items

One of my tasks is to incorporate a copy and delete button within a table. My goal is to pass the index from the map to the delete and copy onclick functions, however, I am encountering an issue where copying a row results in it having the same index as th ...