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

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"

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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

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

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

Still facing the issue with latest composer version 1.5.2 2017

@samdark’s solution is working

composer self-update 1.0.0-alpha11
composer clear-cache

thanks!

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.

Still getting this error in 2020 😦

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