• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

使用composer创建laravel项目:Composer could not find the config file?

php 搞代码 4年前 (2022-01-25) 38次浏览 已收录 0个评论
文章目录[隐藏]

按照文档操作,

1.先安装composer,然后下载laravel安装包:
composer global require "laravel/installer=~1.1"
命令执行成功。

2.将目录~/.composer/vendor/bin添加到系统环境变量中。
3.运行laravel new test命令创建laravel项目,报错如下:

<code>E:\>laravel new testCrafting application...Composer could not find the config file: C:\Users\yanwushu\vendor\binTo initialize a project, please create a composer.json file as described in thehttps://getcomposer.org/ "Getting Started" sectionApplication ready! Build something amazing.</code>

个人对composer和laravel都没有比较清晰的理解,请熟悉的同志给予指点。

回复内容:

按照文档操作,

1.先安装composer,然后下载laravel安装包:
composer global require "laravel/installer=~1.1"
命令执行成功。

2.将目录~/.composer/vendor/bin添加到系统环境变量中。
3.运行laravel new test命令创建laravel项目,报错如下:

<code>E:\>laravel new testCrafting application...Composer could not find the config file: C:\Users\yanwushu\vendor\binTo initialize a project, please create a composer.json file as described in thehttps://getcomposer.org/ "Getting Started" sectionApplication ready! Build something amazing.</code>

个人对composer和laravel都没有比较清晰的理解,请熟悉的同志给予指点。

在命令行里执行

<code>composer config -l -g</code>

在输出的结果中,其中的 【home】 配置项内容就是了composer的主目录,然后进入vendor\bin,将这个路径加入环境变量。
从上面的报错信息里可以看出,你用来初始化项目的vendor\binC:\Users\yanwushu\vendor\bin,你需要确定这个路径是composer的主目录,且下面的vendor\bin存在。建议执行一下我上面说的方法,查看一下路径,然后添加正确路径到环境变量。

建议在检查下第2步的操作

1本文来#源gaodai$ma#com搞$代*码*网

搞代gaodaima码

composer selfupdate//composer版本低?


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:使用composer创建laravel项目:Composer could not find the config file?

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址