Yii2 fresh install: vendor/bower/jquery/dist path is wrong
Solution 1
Please, refer the installation guide. It seems that you are missing asset plugin:
composer global require "fxp/composer-asset-plugin:~1.2.0"
Solution 2
Make sure you have executed this command:
composer global require "fxp/composer-asset-plugin:~1.2.0"
Also, check your composer.json for these followings:
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 either composer update
if you already have a composer.lock
file, or composer install
if you don't have composer.lock
file yet.
Solution 3
I was facing same issue,
this is how I fixed it-
-
go to vender .
$ cd projectFile/vendor/
-
Rename bower-asset with bower
$ mv bower-asset/ bower
Restart mamp/xamp
That fixed the issue and http://localhost:8888/ is working well.
Solution 4
Check your composer.json file in the root of your project. You should have a section that look slike this;
"asset-installer-paths": {
"bower-asset-library": "vendor/bower-assets"
}
This tells composer where to locate the bower files library. You may need to run composer update afterwards to get hte locations updated.
varan
Updated on June 22, 2022Comments
-
varan almost 2 years
I just installed yii2 (advanced) using composer. I've setup nginx, etc.
But it doesn't 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 the only subfolder 'bower-assets' with 'jquery', etc in it. But no jquery in vendor/bower.
How to solve this issue?
-
josliber over 8 yearsPlease don't post identical answers to multiple questions. Post one good answer, then vote/flag to close the other questions as duplicates. If the question is not a duplicate, tailor your answers to the question.
-
PLM57 over 6 yearsThis is totally the wrong way, sorry. You hereby detach your assets from being updated. The same folder will be created again and be update...but sadly not used ;)!
-
contemplator over 6 yearsThis solution worked for me, after I edited out the last s. It should be
"bower-asset-library": "vendor/bower-asset"
-
Joe Miller about 6 years@contemplator it doesn't actually matter what name the asset folder has, as long as a folder with that name actually exists. On your local machine, the folder is bower-asset. On mine it's bower-assets. The name is irrelevant, as long as the entry in the composer file points to the correct place
-
Tom about 6 yearsIt seems from my tests that this package does indeed need to be
global
. I tried it included only in my yii project and had no luck. -
cha over 4 yearsWrong way to do. It will be updated again when you do 'composer update'
-
cha over 4 yearsWrong way to do. It will be updated again when you do 'composer update'