Yii2 fresh install: vendor/bower/jquery/dist path is wrong

前端 未结 5 1497
星月不相逢
星月不相逢 2021-02-08 15:37

I just installed yii2 (advanced) using composer. I\'ve setup nginx, etc.

But it doesn\'t work:

Invalid Parameter – yii\\base\\InvalidParamException

The          


        
相关标签:
5条回答
  • 2021-02-08 16:04

    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.

    0 讨论(0)
  • 2021-02-08 16:10

    It seems your jquery/distis under bower/bower-asset instead under bower. In order to solve your problem, please move all bower-assetcontent including jquery subfolder and others like: bootstrap, yii2-pjax, puny code, etc. in bower folder (one level up). All these subfolders will be at the same level with bower-asset under bower folder. Now you can delete bower-asset folder if you want.

    Before you had:

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

    Now you have:

    vendor/bower/jquery/dist...

    There shouldn't be any bower-asset subfolder.

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

    0 讨论(0)
  • 2021-02-08 16:12

    Please, refer the installation guide. It seems that you are missing asset plugin:

    composer global require "fxp/composer-asset-plugin:~1.2.0"
    
    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-08 16:25

    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.

    0 讨论(0)
提交回复
热议问题