Bower folder not found in provider folder in main yii2 application

I downloaded the base yii2 application. Then switched to git. But then on another PC, I installed all the dependencies using the composer. But I do not have a folder with a buffer, so you get an error:

The file or directory to be published does not exist: C:\xampp\htdocs\jumpbyte-site\vendor\bower/jquery/dist'

In my composer.json file, dependencies are required:

 "require": { "php": ">=5.4.0", "yiisoft/yii2": "*", "yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-swiftmailer": "*", "himiklab/yii2-sitemap-module": "*" }, 
+6
source share
6 answers

To manage bower and npm package dependencies using Composer, you need to install (globally) fxp / composer-asset-plugin :

 composer global require "fxp/composer-asset-plugin:~1.1.1" composer install 

More details: http://www.yiiframework.com/doc-2.0/guide-start-installation.html#installing-via-composer

+12
source

load default dependencies first

 composer global require "fxp/composer-asset-plugin:~1.0.3" 

then just run

 composer install 

then reload your site.

+4
source

Go to / vendor / yiisoft / yii 2 / base / Application.php.

Go to line 456.

Change

Yii :: setAlias ​​('@bower', $ this → _ vendorPath. DIRECTORY_SEPARATOR. 'Bower');

to

Yii :: setAlias ​​('@bower', $ this → _ vendorPath. DIRECTORY_SEPARATOR. 'Bower'. DIRECTORY_SEPARATOR. 'Bower-asset');

+1
source

It might break something later, but it was much faster than trying to root out a problem with the composer. I also tried this to no avail. I just decided to give him what I asked for.

If someone knows why this workaround is not suitable, please talk.

Go to / vendor / yiisoft / yii 2 / 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'); } 
+1
source

(for new installation) On Windows.

  • Remove composer on windows and reinstall. after that
  • composer global require "fxp/composer-asset-plugin:~1.1.1"
  • composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application

(for updating): delete the contents in the directory:

  • provider deletes file
  • composer.lock than
  • composer install

Thats all

0
source

In my case, I had an old version of the asset-linker plugin, and it did not work properly. Only the update helps me. So, update the latest composer plugin version:

composer global require "fxp/composer-asset-plugin:^1.2.0"

See ^1.2.0 . It is important.

Then run the following commands:

 rm -rf vendor/* rm composer.lock composer install 
0
source

Source: https://habr.com/ru/post/984232/


All Articles