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

Created on 20 Nov 2015  路  17Comments  路  Source: yiisoft/yii2

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"

critical bug

Most helpful comment

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.

All 17 comments

To reproduce

$ git clone [email protected]: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
$sed -n '456'p vendor/yiisoft/yii2/base/Application.php 
        Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');

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

Simple solution is by

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

but I don't know what cause this.

Composer master is broken.

composer self-update 1.0.0-alpha11
composer clear-cache

Then repeat.

@samdark's solution is working

composer self-update 1.0.0-alpha11
composer clear-cache

thanks!

This is now fixed and fxp plugin is tagged.

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

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

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

Still facing the issue with latest composer version 1.5.2 2017

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

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.

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.

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sobit picture sobit  路  3Comments

skcn022 picture skcn022  路  3Comments

psfpro picture psfpro  路  3Comments

SamMousa picture SamMousa  路  3Comments

newscloud picture newscloud  路  3Comments