Running gulp command results in a syntax error “Unexpected token,”

Jira Code: ESMILES-29

Resolve the error while running the gulp command for the source code of SCA 2019.1

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



Step 1: Edit the package.json File
This step explains how to add a new dependency to the package.json file, located in your top-level source code directory. You can download the code samples described in this procedure here: package.json.zip.

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

Open the package.json file.

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"
            },
            //...
Save the file.

Step 2: Reinstall Dependencies and Test Your Changes
This step explains how to reinstall the Node.js dependencies required by the developer tools.

In your top-level source files directory, 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.

Open a command line or terminal.

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

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

npm install

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

Run Gulp.js using the following command:

gulp

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

Leave a comment

Your email address will not be published. Required fields are marked *