Choose bower install directory

Bower

Bower Problem Overview


This is a follow-up to this question. I'm using bower 0.7.1, and still cannot get the components to be installed anywhere else than in the components folder.

I tried adding the following line to my component.json, as per this PR:

"componentsDirectory": "public/components"

But it will still install in ./components.

I tried to create a .bowerrc file next to component.json:

{
  "directory" : "public/components"
}

But I get this error when running bower install:

> Error: Unable to parse local .bowerrc file: Unexpected token }

Any idea?

Bower Solutions


Solution 1 - Bower

Actually the .bowerrc file does work, this was an issue with my IDE not saving the file properly:

{
  "directory" : "public/components"
}

I'm still wondering why componentsDirectory still doesn't work in component.json, though.

Solution 2 - Bower

While you can happily use Bower to manage the dependencies of your own personal projects, primarily the component.json is a description of your project for other people. If you share a component through the Bower registry the component.json goes with it to describe the dependencies. That is why your own local preferences like where to install components don't belong in there.

Solution 3 - Bower

Another way to change installation directory temporarily is using --config option in command line:

bower install jquery --config.directory=/path/to/your/components

Solution 4 - Bower

If you are creating this file in Notepad++, make sure the Encoding is set to "Encode in UTF-8 without BOM" and save as file type "Any".

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBenMorelView Question on Stackoverflow
Solution 1 - BowerBenMorelView Answer on Stackoverflow
Solution 2 - BowerMatView Answer on Stackoverflow
Solution 3 - BowerfrustigorView Answer on Stackoverflow
Solution 4 - BowerchrisView Answer on Stackoverflow