我如何摆脱 yii2 中的 composer-asset-plugin [英] How do I get rid of composer-asset-plugin in yii2

查看:24
本文介绍了我如何摆脱 yii2 中的 composer-asset-plugin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从 fxp\composer-asset-plugin 去年坏了,我在安装 yii2 时一直遇到问题.

Since the fxp\composer-asset-plugin broke last year, I am continuously experiencing problems installing yii2.

每当我运行 composer update 命令时,它都会由于这个 composer 资产插件而失败.每天都会弹出一个新错误.我已经阅读了许多文章,github 问题,Sam 和 Alexander(Yii 框架的维护者)不断回答相同的问题,然后将关闭该主题.此插件的所有更新似乎都不是万无一失的解决方案.

whenever I run a composer update command it fails due to this composer asset plugin. Everyday a new error pops up. I have read number of articles, github issues, with Sam and Alexander (maintainers of Yii Framework) continuously replying to the same problem then would close the topic. none of the updates to this plugin seem to be a fool-proof solution.

现在不再询问如何解决由该插件引起的错误(假设到目前为止没有人有 100% 有效的解决方案,只有有时"有效的解决方法),

Now instead of asking how to solve the errors caused by this plugin (assuming that no one has a 100% working solution till date, only workarounds that work only 'sometimes'),

我如何摆脱这个插件并且我不能通过 bower 或 npm 手动安装软件包?

how do I get rid of this plugin and can't I manually install the packages through bower or npm?

简而言之,我的意思是,

In short, I mean,

在 Yii 2.0 中,如果没有这个插件,生活是可能的,它变成了问题的创造者,而不是解决问题.

In Yii 2.0, is life possible without this plugin, which has become a problem creator instead of solving problems.

推荐答案

您可以使用 https://asset-packagist.组织 代替.在 composer.json 中添加:

You can use https://asset-packagist.org instead. Add this in composer.json:

"repositories": [
    {
        "type": "composer",
        "url": "https://asset-packagist.org"
    }
],

唯一的问题是资产安装在不同的文件夹中,因此您需要更改别名.将此添加到一些常见的配置文件中:

Only problem is assets are installed in the different folder so you need to change the aliases. Add this in some common config file:

'aliases' => [
    '@bower' => '@vendor/bower-asset',
    '@npm' => '@vendor/npm-asset',
],

这篇关于我如何摆脱 yii2 中的 composer-asset-plugin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆