在 yii2 基本应用程序的供应商文件夹中找不到 Bower 文件夹
Bower folder is not found in vendor folder in yii2 basic application
我下载了一个基本的 yii2 application.And 然后推入 git.But 然后在其他电脑上我使用作曲家安装了所有依赖项。但是我现在没有 bower 文件夹所以出现错误:
The file or directory to be published does not exist:
C:\xampp\htdocs\jumpbyte-site\vendor\bower/jquery/dist'
我的 composer.json 文件具有以下要求依赖项:
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"himiklab/yii2-sitemap-module": "*"
},
要通过 Composer 管理 bower 和 npm 包依赖项,您需要安装(全局)fxp/composer-asset-plugin :
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer install
阅读更多:http://www.yiiframework.com/doc-2.0/guide-start-installation.html#installing-via-composer
先下载默认依赖
composer global require "fxp/composer-asset-plugin:~1.0.3"
然后 运行
composer install
然后重新加载您的网站。
(用于全新安装)
在 Windows.
- 删除 windows 上的作曲家并重新安装。
之后
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
(待更新):
删除目录中的内容:
- 供应商删除文件
- composer.lock 比
composer install
就这些了
转到 /vendor/yiisoft/yii2/base/Application.php.
转到第 456 行。
改变
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');
到
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower' . DIRECTORY_SEPARATOR . 'bower-asset');
这可能会在以后破坏某些东西,但这比尝试根除作曲家问题要快得多。我也尝试过但无济于事。我只是决定满足它的要求。
如果有人知道为什么这个解决方法不好,请说出来。
转到 /vendor/yiisoft/yii2/base/Application.php.
public function setVendorPath($path)
{
$this->_vendorPath = Yii::getAlias($path);
Yii::setAlias('@vendor', $this->_vendorPath);
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower-asset'); //it was just 'bower'
Yii::setAlias('@npm', $this->_vendorPath . DIRECTORY_SEPARATOR . 'npm');
}
就我而言,我使用的是旧版本的 composer-asset-plugin,它无法正常工作。只有更新对我有帮助。所以更新到最新版本的 composer-asset-plugin:
composer global require "fxp/composer-asset-plugin:^1.2.0"
看看^1.2.0
。很重要。
然后执行以下命令:
rm -rf vendor/*
rm composer.lock
composer install
我下载了一个基本的 yii2 application.And 然后推入 git.But 然后在其他电脑上我使用作曲家安装了所有依赖项。但是我现在没有 bower 文件夹所以出现错误:
The file or directory to be published does not exist: C:\xampp\htdocs\jumpbyte-site\vendor\bower/jquery/dist'
我的 composer.json 文件具有以下要求依赖项:
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"himiklab/yii2-sitemap-module": "*"
},
要通过 Composer 管理 bower 和 npm 包依赖项,您需要安装(全局)fxp/composer-asset-plugin :
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer install
阅读更多:http://www.yiiframework.com/doc-2.0/guide-start-installation.html#installing-via-composer
先下载默认依赖
composer global require "fxp/composer-asset-plugin:~1.0.3"
然后 运行
composer install
然后重新加载您的网站。
(用于全新安装) 在 Windows.
- 删除 windows 上的作曲家并重新安装。 之后
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
(待更新): 删除目录中的内容:
- 供应商删除文件
- composer.lock 比
composer install
就这些了
转到 /vendor/yiisoft/yii2/base/Application.php.
转到第 456 行。
改变
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');
到
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower' . DIRECTORY_SEPARATOR . 'bower-asset');
这可能会在以后破坏某些东西,但这比尝试根除作曲家问题要快得多。我也尝试过但无济于事。我只是决定满足它的要求。
如果有人知道为什么这个解决方法不好,请说出来。
转到 /vendor/yiisoft/yii2/base/Application.php.
public function setVendorPath($path)
{
$this->_vendorPath = Yii::getAlias($path);
Yii::setAlias('@vendor', $this->_vendorPath);
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower-asset'); //it was just 'bower'
Yii::setAlias('@npm', $this->_vendorPath . DIRECTORY_SEPARATOR . 'npm');
}
就我而言,我使用的是旧版本的 composer-asset-plugin,它无法正常工作。只有更新对我有帮助。所以更新到最新版本的 composer-asset-plugin:
composer global require "fxp/composer-asset-plugin:^1.2.0"
看看^1.2.0
。很重要。
然后执行以下命令:
rm -rf vendor/*
rm composer.lock
composer install