Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bower throwing errors

Tags:

bower

I've installed bower but getting these errors, any idea?

[noor@laptop03 ~]$ bower 

/usr/local/lib/node_modules/bower/node_modules/bower-config/lib/util/rc.js:55
        throw error;
              ^
like image 353
Noor Avatar asked Aug 14 '14 04:08

Noor


1 Answers

Yesterday I had the same problem. If your full error log was this one:

/usr/local/lib/node_modules/bower/node_modules/bower-config/lib/util/rc.js:55
    throw error;
          ^
Error: Unable to parse /vagrant/web/.bowerrc: Unexpected token d
at parse (/usr/local/lib/node_modules/bower/node_modules/bower-config/lib/util/rc.js:48:21)
at json (/usr/local/lib/node_modules/bower/node_modules/bower-config/lib/util/rc.js:70:12)
at rc (/usr/local/lib/node_modules/bower/node_modules/bower-config/lib/util/rc.js:31:9)
at Config.load (/usr/local/lib/node_modules/bower/node_modules/bower-config/lib/Config.js:14:20)
at Function.Config.read (/usr/local/lib/node_modules/bower/node_modules/bower-config/lib/Config.js:49:19)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/config.js:3:38)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

Then your .bowerrc possibly missed some quotes. I had this:

{
    directory: "app/Resources/public/vendor"
}

Changed to this and got it working:

{
    "directory": "app/Resources/public/vendor"
}

If you still get another error with Unexpected tokens, check your bower.json for quotes surrounding keys and values.

An example of a valid bower.json:

{
  "name": "project",
  "version": "0.0.0",
    "license": "MIT",
    "private": true,
    "ignore": [
          "**/.*",
          "node_modules",
          "bower_components",
          "test",
          "tests"
      ],
    "dependencies": {
          "jquery": "~2.0.3",
          "underscore": "~1.5.2"
      }
  }
like image 83
Ivo Pereira Avatar answered Nov 27 '22 08:11

Ivo Pereira