简体   繁体   中英

How do I install Bower packages with Yarn?

From the project's README :

Multiple Registries: Install any package from either npm or Bower and keep your package workflow the same.

I'm assuming that means that I can install my Bower packages (listed in my project's bower.json ) with Yarn. If this is the case, how would I go about doing that?

I'm not seeing any mention of Bower or using separate registries in the documentation . However, I do see the Bower registry listed in the source .

UPDATE 11/4/16: Yarn decided to remove support for Bower. See the Github pull request and Bower's blog . =(

ORIGINAL: Bower just posted a blog post about this topic. They seem excited about it, but point out that there are currently unresolved issues:

Important note: As it stands right now there still seem to be some issues regarding Bower support. We are however confident that with the help of the community, these issues will be solved quickly as Yarn steps towards 1.0 in upcoming months.

He also refers to a pull request for a bower patch.

When I ran yarn, it deleted my bower_components folder (GitHub ticket here)! I really like yarn though, can't wait for the bower bugs to get resolved.

Apparently , it should just work. Unfortunately, there's currently a bug where, if you have both a package.json and bower.json in the same project, only the npm packages are installed and the bower packages are ignored.

Normally, one would simply yarn or yarn install and both npm and bower dependencies would be installed.

If you add the following to package.json, bower install will be called and it works. It is a workaround though:

"scripts": {
    "postinstall": "bower install"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM