如何使用纱线安装Bower包?

时间:2023-01-12 19:57:31

From the project's README:

从项目的自述文件中:

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

多个注册表:从npm或Bower安装任何包,并使您的包工作流保持不变。

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?

我假设这意味着我可以用纱线安装我的Bower包(在我的项目的bower.json中列出)。如果是这种情况,我该怎么做呢?

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.

我没有看到任何提及Bower或在文档中使用单独的注册表。但是,我确实看到了源中列出的Bower注册表。

3 个解决方案

#1


10  

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

更新11/4/16:Yarn决定取消对Bower的支持。查看Github pull请求和Bower的博客。 =(

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

原文:Bower刚刚发布了一篇关于这个主题的博文。他们似乎很兴奋,但指出目前尚未解决的问题:

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.

重要提示:目前看来,Bower支持似乎还存在一些问题。然而,我们相信,在社区的帮助下,随着Yarn在接下来的几个月里逐步走向1.0,这些问题将很快得到解决。

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.

当我运行纱线时,它删除了我的bower_components文件夹(这里是GitHub票)!我真的很喜欢纱线,不能等待凉亭的虫子得到解决。

#2


3  

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.

显然,它应该工作。不幸的是,目前存在一个错误,如果在同一个项目中同时包含package.json和bower.json,则只安装npm软件包并忽略bower软件包。

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

通常,只需安装纱线或纱线,就可以安装npm和bower依赖项。

#3


3  

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

如果将以下内容添加到package.json中,将调用bower install并且它可以正常工作。这是一个解决方法:

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

#1


10  

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

更新11/4/16:Yarn决定取消对Bower的支持。查看Github pull请求和Bower的博客。 =(

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

原文:Bower刚刚发布了一篇关于这个主题的博文。他们似乎很兴奋,但指出目前尚未解决的问题:

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.

重要提示:目前看来,Bower支持似乎还存在一些问题。然而,我们相信,在社区的帮助下,随着Yarn在接下来的几个月里逐步走向1.0,这些问题将很快得到解决。

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.

当我运行纱线时,它删除了我的bower_components文件夹(这里是GitHub票)!我真的很喜欢纱线,不能等待凉亭的虫子得到解决。

#2


3  

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.

显然,它应该工作。不幸的是,目前存在一个错误,如果在同一个项目中同时包含package.json和bower.json,则只安装npm软件包并忽略bower软件包。

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

通常,只需安装纱线或纱线,就可以安装npm和bower依赖项。

#3


3  

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

如果将以下内容添加到package.json中,将调用bower install并且它可以正常工作。这是一个解决方法:

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