Asset-builder error but nothing changed

I was working on my theme last night and everything seemed to be working fine. This morning I ran gulp and it started throwing this error:

/home/behemothdan/webapps/sage/wp-content/themes/behemoth/node_modules/asset-builder/node_modules/main-bower-files/lib/index.js:79
        throw e;
              ^
SyntaxError: Unexpected token }
    at Object.parse (native)
    at Object.PackageCollection.collectPackages (/home/behemothdan/webapps/sage/wp-content/themes/behemoth/node_modules/asset-builder/node_modules/main-bower-files/lib/package_collection.js:72:30)
    at Object.PackageCollection (/home/behemothdan/webapps/sage/wp-content/themes/behemoth/node_modules/asset-builder/node_modules/main-bower-files/lib/package_collection.js:29:10)
    at module.exports (/home/behemothdan/webapps/sage/wp-content/themes/behemoth/node_modules/asset-builder/node_modules/main-bower-files/lib/index.js:66:22)
    at new module.exports (/home/behemothdan/webapps/sage/wp-content/themes/behemoth/node_modules/asset-builder/lib/Manifest.js:29:15)
    at module.exports (/home/behemothdan/webapps/sage/wp-content/themes/behemoth/node_modules/asset-builder/index.js:17:10)
    at Object.<anonymous> (/home/behemothdan/webapps/sage/wp-content/themes/behemoth/gulpfile.js:11:40)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)

I tried a few things, including removing the node_modules directory and doing an npm install. I haven’t modified any of the files that it is showing in the error, and line 11 of my gulpfile is unmodified as well.

var manifest = require('asset-builder')('./assets/manifest.json');

In most cases the error of it just having an unexpected } would be simple enough to fix, but I haven’t modified those files. Any suggestions or any brain-dead things I am overlooking? Thanks.

You have a parse error in your assets/manifest.json file. Did you make any changes there?

I added 3 JS references and 1 CSS file reference.

{
  "dependencies": {
    "main.js": {
      "files": [
        "scripts/main.js",
		"scripts/jquery.fittext.js",
		"scripts/jquery.lightSlider.js",
		"scripts/behemoth.js"		
      ],
      "main": true
    },
    "main.css": {
      "files": [
        "styles/main.less",
		"styles/lightSlider.css"
      ],
      "main": true
    },
    "editor-style.css": {
      "files": [
        "styles/editor-style.less"
      ]
    },
    "jquery.js": {
      "bower": ["jquery"]
    },
    "modernizr.js": {
      "bower": ["modernizr"]
    }
  },
  "config": {
    "devUrl": "example.dev"
  }
}

However, even if I remove those file references so that it matches the default version, it throws the same error.

Maybe there’s a parse error in your bower.json file?

Related - https://github.com/ck86/main-bower-files/issues/66

1 Like

Ah yes, that was it. I was originally using bower to install a different package which I decided against using and the last dependency in bower.json had a trailing comma. Thanks for taking the time to respond.

1 Like

This topic was automatically closed after 12 hours. New replies are no longer allowed.