yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

The file or directory to be published does not exist: `bower/jquery/dist` #10198

Closed petrabarus closed 8 years ago

petrabarus commented 8 years ago

I suddenly got this error few hours ago.

The file or directory to be published does not exist: `bower/jquery/dist`

Turns out the there is one more level under directory vendor/bower,

$ ls vendor/bower
bower-asset
$ ls vendor/bower/bower-asset
ace-builds              bootstrap                 handlebars          jquery-slimscroll       magnific-popup  seiyria-bootstrap-slider  zeroclipboard
angular                 bootstrap-hover-dropdown  jquery              jquery.sparkline.build  moment          slick-carousel

while in

https://github.com/yiisoft/yii2/blob/master/framework/base/Application.php#L456

       Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');

I'm using "fxp/composer-asset-plugin:~1.0.3"

petrabarus commented 8 years ago

To reproduce

$ git clone git@github.com:yiisoft/yii2-app-basic.git
$ composer update --prefer-dist
$ ls vendor/
autoload.php  bin/          bower/        cebe/         composer/     ezyang/       fzaninotto/   phpspec/      swiftmailer/  yiisoft/
$ ls vendor/bower/
bower-asset
$ ls vendor/bower/bower-asset
bootstrap  jquery  jquery.inputmask  punycode  typeahead.js  yii2-pjax
petrabarus commented 8 years ago
$sed -n '456'p vendor/yiisoft/yii2/base/Application.php 
        Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');
SilverFire commented 8 years ago

The problem recently occurred and we are trying to figure out what happens.

petrabarus commented 8 years ago

Simple solution is by

Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower/bower-asset');

but I don't know what cause this.

samdark commented 8 years ago

Composer master is broken.

composer self-update 1.0.0-alpha11
composer clear-cache

Then repeat.

petrabarus commented 8 years ago

@samdark's solution is working

composer self-update 1.0.0-alpha11
composer clear-cache

thanks!

samdark commented 8 years ago

https://github.com/francoispluchino/composer-asset-plugin/issues/164

samdark commented 8 years ago

This is now fixed and fxp plugin is tagged.

Bahmad92 commented 7 years ago

go to the directory C:\wamp64\www\yii2-advanced-api\vendor and change bower-asset into bower. this helped me

php5developer commented 7 years ago

I've same problem in 2017 (CARL !). The solution is

  1. rm -r vendor/bower-assets
  2. Open composer.json
  3. config array has following lines: "asset-installer-paths": { "npm-asset-library": "vendor/npm", "bower-asset-library": "vendor/bower" }
  4. Move these lines in extra array
  5. composer update. At termenal you will see "Installing in bowe-assets/jquery...", but in real bower files will be installed in bower directory.
  6. Enjoy
yasiralijaved commented 7 years ago

Just rename the folder "bower-asset" to "bower" in /vender directory. And make sure the directory "bower-asset" has all of its content

baltechies commented 7 years ago

Still facing the issue with latest composer version 1.5.2 2017

cebe commented 7 years ago

make sure you have the latest version of the composer-asset-plugin and the config in composer.json:

https://github.com/yiisoft/yii2-app-basic/blob/0c87fab0c3c9d0ada04a85f4982aeffc08b76cc7/composer.json#L33

fugafree commented 6 years ago

I had the same issue when I updated to the latest composer.json. The solution: update the config/web.php too. Add

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

to $config. Like in the config/web.php on master now.

eramudeep commented 5 years ago

Hey there i am still facing this issue. i tried: 1). 'aliases' => [ '@bower' => '@vendor/bower', '@npm' => '@vendor/npm-asset', ],

  1. Rename Folder bower-asset to bower and vice versa.
  2. Giving proper read write permissions

Need Help.

polishExperiment commented 4 years ago

2020 - this issue still seems to exist and bother me;)

soofdev commented 4 years ago

I had the same issue when I updated to the latest composer.json. The solution: update the config/web.php too. Add

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

to $config. Like in the config/web.php on master now.

This worked for me.

eramudeep commented 3 years ago

Still getting this error in 2020 :(

sunnyphp commented 3 years ago

Some packages, like kriss/yii2-calendar-schedule has provide key in composer.json:

  "provide": {
    "bower-asset/jquery": "*",
    "bower-asset/bootstrap": "*",
    "bower-asset/inputmask": "*",
    "bower-asset/jquery.inputmask": "*",
    "bower-asset/punycode": "*",
    "bower-asset/yii2-pjax": "*",
    "npm-asset/fullcalendar": "*"
  },

and this can affect the installation.

jjoselon commented 2 years ago

Please read README.md of this https://packagist.org/packages/yidas/yii2-bower-asset