Yii2 fresh install: vendor error / bower / jquery / dist is invalid

I just installed yii2 (advanced) using composer. I installed nginx etc.

But this does not work:

Invalid Parameter – yii\base\InvalidParamException The file or directory to be published does not exist: /srv/www/site/vendor/bower/jquery/dist 

In the folder "vendor / bower" there is a single subfolder "bower-assets" with "jquery", etc. in her. But not jquery in vendor / conversation.

How to solve this problem?

+6
source share
5 answers

Please refer to the installation manual . It seems that you are missing the asset plugin:

 composer global require "fxp/composer-asset-plugin:~1.2.0" 
+9
source

Make sure you run this command:

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

Also check your composer.json for the following:

Deprecated but default option from Yii2:

 "extra": { "asset-installer-paths": { "npm-asset-library": "vendor/npm", "bower-asset-library": "vendor/bower" } }, 

New option

 "config": { "fxp-asset": { "installer-paths": { "npm-asset-library": "vendor/npm", "bower-asset-library": "vendor/bower" }, } }, 

Then run composer update if you already have a composer.lock file, or composer install if you don't already have a composer.lock file.

+4
source

I ran into the same problem
this is how i fixed it-

  • go to the seller.

     $ cd projectFile/vendor/ 
  • Rename a Bauer Asset with a Bauer

     $ mv bower-asset/ bower 
  • Restart mamp / xamp

This solved the problem and http: // localhost: 8888 / works well.

+2
source

Check the composer.json file in the root directory of your project. You should have a section that looks like this:

  "asset-installer-paths": { "bower-asset-library": "vendor/bower-assets" } 

This tells the composer where to find the bower file library. You may need to update the composer to update the hte addresses.

+1
source

It seems your jquery/dist is under bower/bower-asset instead of bower . To solve your problem, move all bower-asset content, including the jquery subdirectory, and others like bootstrap , yii2-pjax , puny code , etc. In the bower folder (one level up). All these subfolders will be on the same level as the bower-asset in the bower folder. Now you can delete the bower-asset folder if you want.

Before you received:

vendor/bower/bower-asset/jquery/dist/...

Now you have:

vendor/bower/jquery/dist...

There should not be a bower-asset subfolder.

This will solve your problem and the yii2 application will work as it should.

0
source

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


All Articles