简体   繁体   中英

Getting [ErrorException] - installing yii2 using composer

I am trying to install Yii2 on WAMP using composer.

c:\Users\username>php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.0

I am getting the following error when I run the command which is given above.

[ErrorException] Argument 1 passed to Fxp\\Composer\\AssetPlugin\\Repository\\BowerRepository::createVcsRepositoryConfig() must be of the type array, null given, called in C:\\Users\\username\\AppData\\Roaming\\Composer\\vendor\\fxp\\composer-asset-plugin\\Repository\\AbstractAssetsRepository.php on line 136 and defined

Can someone help solving this error? But, it is created a folder named "basic".

I have copied this folder to D:\\wamp\\www and when I access localhost/basic/web/ from browser, I am getting the following error.

ReflectionException
Class yii\\debug\\Module does not exist

I am following the instructions to install yii2 from http://www.yiiframework.com/download/

Please assist me to resolve these issues.

Thanks

EDIT: Thank you for reminding me.

This error happens because of invalid json on plugin you or application requested (npm or bower).

The link here suggests you to run:

composer global update .

This will update composer cache. Hope it helps.

First windows does not have a curl processor like unix so you need to use the other option for installing Composer

php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"

For this to work you need the php.exe processor to be on your path, so you have 2 options here. Either add the c:\\wamp\\bin\\php\\phpx.yz folder to your PATH or my prefered option write yourself a little .cmd file which will do it for you like this

addphp.cmd
PATH=%PATH%;c:\wamp\bin\php\phpx.y.z

Put this file in a folder already registered on your path so you can run it from anywhere in a command window.

Now you will have to edit the \\wamp\\bin\\php\\phpx.yz\\php.ini file. This is similiar to the one used by php code run through the Apache web server but is only used by the PHP CLI (Command Line Interpreter)

Make sure the extension php_curl is uncommented or the above line wont work ie remove the ; comment symbol

extension=php_curl.dll

So now run a command window, cd into the folder that you want composer installed into and run the command above, then follow the rest of the install instructions on Install instructions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM