ahmadawais / WPGulp

An advanced Gulp workflow for WordPress development with extensive documentation. Used by 40,000+ themes and plugins.
https://twitter.com/MrAhmadAwais/
MIT License
1.77k stars 303 forks source link

SyntaxError in plugin "gulp-notify" #148

Open tomhayes opened 5 years ago

tomhayes commented 5 years ago

Bug Report

I've updated the config file and when I runnpm start everything seems to run ok the first time (and compiles SASS)... but then when it reaches the end (after STYLES - completed! I get the error and the task doesn't seem to continue watching/compiling files:

Message:
    Unexpected token { in JSON at position 129
[12:42:20] gulp-notify: [Error in notifier] SyntaxError in plugin "gulp-notify"
Message:
    Unexpected token { in JSON at position 129

I'm on OSX Mojave 10.14.5 and using a Docker container.

I've installed notify-send in the project with npm install notify-send but this has made no difference. I've also installed libnotify globally on my system with brew install libnotify but this has also not fixed the issue.

I've also tried adding double quotes around the properties as mentioned in https://github.com/mikaelbr/gulp-notify/issues/129

  1. node -v: v10.16.0
  2. npm -v: 6.9.0.
ahmadawais commented 5 years ago

Your configuration might have a syntax error. Did you check that?

tomhayes commented 5 years ago

Hmmm I think it's all ok...

/**
 * WPGulp Configuration File
 *
 * 1. Edit the variables as per your project requirements.
 * 2. In paths you can add <<glob or array of globs>>.
 *
 * @package WPGulp
 */

module.exports = {

    // Project options.
    projectURL: '127.0.0.1:8080', // Local project URL of your already running WordPress site. Could be something like wpgulp.local or localhost:3000 depending upon your local WordPress setup.
    productURL: './', // Theme/Plugin URL. Leave it like it is, since our gulpfile.js lives in the root folder.
    browserAutoOpen: false,
    injectChanges: true,

    // Style options.
    styleSRC: './assets/sass/style.scss', // Path to main .scss file.
    styleDestination: './assets/css', // Path to place the compiled CSS file. Default set to root folder.
    outputStyle: 'compact', // Available options → 'compact' or 'compressed' or 'nested' or 'expanded'
    errLogToConsole: true,
    precision: 10,

    // JS Vendor options.
    jsVendorSRC: './assets/js/vendor/*.js', // Path to JS vendor folder.
    jsVendorDestination: './assets/js/', // Path to place the compiled JS vendors file.
    jsVendorFile: 'vendor', // Compiled JS vendors file name. Default set to vendors i.e. vendors.js.

    // JS Custom options.
    jsCustomSRC: './assets/js/custom/*.js', // Path to JS custom scripts folder.
    jsCustomDestination: './assets/js/', // Path to place the compiled JS custom scripts file.
    jsCustomFile: 'custom', // Compiled JS custom file name. Default set to custom i.e. custom.js.

    // Images options.
    imgSRC: './assets/img/raw/**/*', // Source folder of images which should be optimized and watched. You can also specify types e.g. raw/**.{png,jpg,gif} in the glob.
    imgDST: './assets/img/', // Destination folder of optimized images. Must be different from the imagesSRC folder.

    // Watch files paths.
    watchStyles: './assets/scss/**/*.scss', // Path to all *.scss files inside css folder and inside them.
    watchJsVendor: './assets/js/vendor/*.js', // Path to all vendor JS files.
    watchJsCustom: './assets/js/custom/*.js', // Path to all custom JS files.
    watchPhp: './**/*.php', // Path to all PHP files.

    // Translation options.
    textDomain: 'mysocialnetwork', // Your textdomain here.
    translationFile: 'mysocialnetwork.pot', // Name of the translation file.
    translationDestination: './languages', // Where to save the translation files.
    packageName: 'mysocialnetwork', // Package name.
    bugReport: 'https://TomHay.es', // Where can users report bugs.
    lastTranslator: 'Tom Hayes <hello@tomhay.es>', // Last translator Email ID.
    team: 'Tom Hayes <hello@tomhay.es>', // Team's Email ID.

    // Browsers you care about for autoprefixing. Browserlist https://github.com/ai/browserslist
    // The following list is set as per WordPress requirements. Though, Feel free to change.
    BROWSERS_LIST: [
        'last 2 version',
        '> 1%',
        'ie >= 11',
        'last 1 Android versions',
        'last 1 ChromeAndroid versions',
        'last 2 Chrome versions',
        'last 2 Firefox versions',
        'last 2 Safari versions',
        'last 2 iOS versions',
        'last 2 Edge versions',
        'last 2 Opera versions'
    ]
};
JeremyEnglert commented 5 years ago

The error you're getting and the fact you made config changes makes me think this is a config issue, but your config looks fine and the config file isn't JSON (which the error points to).

If you go back to the default config file, do you still have the issue?

tomhayes commented 5 years ago

Changed back to the default config file and still getting the same issue!

tomhayes commented 5 years ago

As it seems to be a issue with the notification system, is there a way I can just disable this? messages in the command line are enough for me!

ahmadawais commented 5 years ago

Feel free to contribute a setting that is checked when writing messages. Your contributions are welcomed.