Running Gulp Commands Results in a Syntax Error

Running any gulp commands from a command line or terminal can result in the following error:

SyntaxError: Invalid flags supplied to RegExp constructor 'u' at new RegExp (native)

To correct this error, edit the package.json file and reinstall Node.js dependencies for your top-level source files directory.

Note:

This procedure requires editing the package.json code directly. You cannot override or extend this file.

You can download the code samples described in this procedure here: package.json.zip.

Step 1: Edit the package.json File

  1. To add a new dependency to the package.json file located in your top-level source code directory, navigate to the top-level directory containing your SuiteCommerce Advanced source files.

  2. Open the package.json file.

  3. Add the following dependency to the dependencies object:

                    "xmlbuilder": "8.2.2" 
    
                  

    Your edited code should look similar to the following:

                    {
                "name": "suitecommerce-builder",
                "version": "0.0.1",
                "description": "Sets of tasks to build a Reference Implementation",
                "main": "gulpfile.js",
                "private": true,
                "scripts": {
                   "test": "echo \"Error: no test specified\" && exit 1"
                },
                "author": "",
                "license": "ISC",
                "dependencies": {
                   //...
                   "suitetalk": "file:./ns_npm_repository/suitetalk4node",
                   "preconditions": "file:./ns_npm_repository/preconditions",
                   "xmlbuilder": "8.2.2"
                },
                //... 
    
                  
  4. Save the file.

Step 2: Reinstall Dependencies and Test Your Changes

  1. To reinstall the Node.js dependencies required by the developer tools In your top-level source files directory, first delete the node_modules/ subdirectory.

    Deleting this subdirectory removes the dependencies and other files that were created when you initially set up your developer environment. See Install Additional Files in the Source Directory for more information on this process.

  2. Open a command line or terminal.

  3. Navigate to the top-level directory containing your SuiteCommerce Advanced source files.

  4. Run the following command to reinstall the dependencies and include your edits:

    npm install

  5. Open a command line or terminal and navigate to your top-level source files directory.

  6. Run Gulp.js using the following command:

    gulp

    This and any other gulp commands should run with no errors.

Related Topics

SCA Patches

General Notices