欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Composer could not find a composer.json file in C:\Users\Administrator\AppData\Roaming\Composer To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

 

我试图通过brew安装作曲家:

usr/local/bin(这不是在Mavricks和我不得不个人)我做到了。

brew tap josegonzalez/homebrew-php brew install josegonzalez/php/composer

我可以运行php composer.phar,但是当我这样做php composer.phar install,我得到的错误:

Composer could not find a composer.json file in /usr/local/bin To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section

所以我去看https://getcomposer.org/doc/00-intro.mdCRTL + F“.json”,没有什么。严肃作曲?

编辑:我想做的是有composer可执行文件php composer.phar这在现在从这里工作。
 

正确答案 

01日原作者:

“入门”页面是,显然没有注意到,文档的介绍。大多数文档将从安装说明开始,就像Composer的做法一样。

包含该composer.json文件信息的页面位于此处 - 第二页的“基本用法”下。

我建议阅读完整的文档,以便您更好地了解如何使用Composer。我还建议删除您所拥有的,并按照文档中提供的安装说明。

分享改进这个答案
 

要安装作曲家并添加到您的全局路径:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

在终端运行这些。它说,如果你得到一个错误,usr不存在,你需要手动使它。我知道答案被选中,所以这是任何人谁可能看到这在未来,因为我有时,不想被告知访问另一个网站。它的简单只是两行,可能必须在sudo如果你有权限错误

分享改进这个答案
 

在我的情况下,我没有复制所有的项目文件到我正在运行的文件夹composer install所以做:

  1. 将项目文件(包括composer.json复制到文件夹
  2. 打开CMD(我使用ConEmu),导航到新文件夹,composer install从那里运行
  3. 它应该工作或抛出错误,以防json文件不正确。

如果您只想让作曲家运行,请创建一个新composer.json文件,例如:

{
    "require": {
        "php": ">=5.3.2"
    }
}

然后运行composer install

分享改进这个答案
 

简单的解决方案是通过这个命令安装:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

要安装包非常简单:

 composer global require "phpunit/php-invoker=1.1.*"

参考:作曲家网站

来自 http://stackoverflow.com/questions/31900211/composer-could-not-find-a-composer-json


 

 

I tried to install composer via brew per:

In usr/local/bin (which was not on Mavricks and I had to make personally) I did.

brew tap josegonzalez/homebrew-php brew install josegonzalez/php/composer

I can run php composer.phar, but when I do php composer.phar install, I get the error:

Composer could not find a composer.json file in /usr/local/bin To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section

So I go to the https://getcomposer.org/doc/00-intro.md. CRTL + F ".json" and nothing's there. Seriously composer?

EDIT: What I was trying to do was to have composer executable vs php composer.phar. This works at this point from this now.

shareimprove this question
 

The "Getting Started" page is, as you obviously didn't notice, the introduction to the documentation. Most documentation will start off with installation instructions, just like Composer's do.

The page that contains information on the composer.json file is located here - under "Basic Usage", the second page.

I'd recommend reading over the documentation in full, so that you gain a better understanding of how to use Composer. I'd also recommend removing what you have and following the installation instructions provided in the documentation.

shareimprove this answer
 
 

To install composer and add to your global path:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

run these in terminal. It does say if you get an error that usr doesn't exist, you do need to manually make it. I know an answer was selected, so this is for anyone who may see this in the future, as i am sometimes, and don't want to be advised to visit yet another site. Its simple just two lines, might have to be in sudo if you have permission error

shareimprove this answer
 

In my case, I did not copy all project files to the folder where I was running composer install. So do:

  1. Copy your project files (including the composer.json) to folder
  2. open CMD (I am using ConEmu), navigate to the new folder, run composer install from there
  3. It should work or throw errors in case the json file is not correct.

If you just want to make composer run, create a new composer.json file with for example:

{
    "require": {
        "php": ">=5.3.2"
    }
}

Then run composer install.

shareimprove this answer
 

Simple solution is install via this command :

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

To install package it's very simple :

 composer global require "phpunit/php-invoker=1.1.*"

Ref : composer web site.

来自  http://stackoverflow.com/questions/31900211/composer-could-not-find-a-composer-json

01日原作者:

“入门”页面是,显然没有注意到,文档的介绍。大多数文档将从安装说明开始,就像Composer的做法一样。

包含该composer.json文件信息的页面位于此处 - 第二页的“基本用法”下。

我建议阅读完整的文档,以便您更好地了解如何使用Composer。我还建议删除您所拥有的,并按照文档中提供的安装说明。

分享改进这个答案
 

要安装作曲家并添加到您的全局路径:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

在终端运行这些。它说,如果你得到一个错误,usr不存在,你需要手动使它。我知道答案被选中,所以这是任何人谁可能看到这在未来,因为我有时,不想被告知访问另一个网站。它的简单只是两行,可能必须在sudo如果你有权限错误

分享改进这个答案
 

在我的情况下,我没有复制所有的项目文件到我正在运行的文件夹composer install所以做:

  1. 将项目文件(包括composer.json复制到文件夹
  2. 打开CMD(我使用ConEmu),导航到新文件夹,composer install从那里运行
  3. 它应该工作或抛出错误,以防json文件不正确。

如果您只想让作曲家运行,请创建一个新composer.json文件,例如:

{
    "require": {
        "php": ">=5.3.2"
    }
}

然后运行composer install

分享改进这个答案
 

简单的解决方案是通过这个命令安装:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

要安装包非常简单:

 composer global require "phpunit/php-invoker=1.1.*"

参考:作曲家网站


普通分类: