Choose bower install directory

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?


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.


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.


另一种暂时更改安装目录的方法是在命令行中使用--config选项:

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

链接地址: http://www.djcxy.com/p/20086.html

上一篇: json没有bower.json文件保存为“

下一篇: 选择凉亭安装目录