简体   繁体   English

获取[ErrorException]-使用composer安装yii2

[英]Getting [ErrorException] - installing yii2 using composer

I am trying to install Yii2 on WAMP using composer. 我正在尝试使用composer在WAMP上安装Yii2。

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 [ErrorException]传递给Fxp \\ Composer \\ AssetPlugin \\ Repository \\ BowerRepository :: createVcsRepositoryConfig()的参数1必须为数组类型,给定为空,在C:\\ Users \\ username \\ AppData \\ Roaming \\ Composer \\ vendor \\ fxp \\中调用第136行的composer-asset-plugin \\ Repository \\ AbstractAssetsRepository.php并已定义

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. 我已将此文件夹复制到D:\\wamp\\www ,当我从浏览器访问localhost/basic/web/时,出现以下错误。

ReflectionException ReflectionException
Class yii\\debug\\Module does not exist yii \\ debug \\ Module类不存在

I am following the instructions to install yii2 from http://www.yiiframework.com/download/ 我正在按照指示从http://www.yiiframework.com/download/安装yii2

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). 发生此错误是由于您或请求的应用程序(npm或bower)上的json无效。

The link here suggests you to run: 此处的链接建议您运行:

composer global update . 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 第一个Windows没有像unix这样的curl处理器,因此您需要使用其他选项来安装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. 为此,您需要在路径上使用php.exe处理器,因此这里有2个选项。 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 将c:\\ wamp \\ bin \\ php \\ phpx.yz文件夹添加到您的PATH或我的首选选项中,给自己写一个.cmd文件,它将像您这样

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. 现在,您将必须编辑\\ wamp \\ bin \\ php \\ phpx.yz \\ php.ini文件。 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) 这与通过Apache Web服务器运行的php代码所使用的类似,但是仅由PHP CLI(命令行解释器)使用。

Make sure the extension php_curl is uncommented or the above line wont work ie remove the ; 确保扩展名php_curl取消注释,否则上述行将无法正常工作,即删除;; 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 因此,现在运行一个命令窗口,将其安装到您要安装作曲家的文件夹中,并运行上面的命令,然后按照安装说明中的其余安装说明进行操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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