0

我有关注composer.json

{
    "name": "mjohnson/transit",
    "type": "library",
    "description": "A file uploader, validator, importer and transformer library.",
    "keywords": [
        "transit", "file", "uploader", "validator", "importer", "transformer", "transporter",
        "image", "audio", "video", "text", "application", "archive", "s3", "glacier"
    ],
    "homepage": "http://milesj.me/code/php/transit",
    "license": "MIT",
    "authors": [
        {
            "name": "Miles Johnson",
            "homepage": "http://milesj.me"
        }
    ],
    "require": {
        "php": ">=5.3.0",
        "ext-curl": "*",
        "ext-mbstring": "*",
        "aws/aws-sdk-php": "2.0.*"
    },
    "support": {
        "source": "https://github.com/milesj/php-transit"
    },
    "autoload": {
        "psr-0": { "Transit": "src/" }
    }
}

当我运行composer update源代码时未更新以反映当前存储库:https://github.com/milesj/transit

我试图删除锁定文件,但没有成功。试过了composer [update|install}

例如,我当前的(本地)代码:

src/Transit/File.php

[...]
public function __construct($path) {
    if (!file_exists($path)) {
        throw new IoException(sprintf('%s does not exist', $path));
    }

    $this->_path = $path;
}
[...]

当前存储库代码

[...]
public function __construct($path) {
    if (is_array($path)) {
        if (empty($path['tmp_name'])) {
            throw new IoException('Passing via array must use $_FILES data');
        }

        $this->_data = $path;
        $path = $path['tmp_name'];
    }

    if (!file_exists($path)) {
        throw new IoException(sprintf('%s does not exist', $path));
    }

    $this->_path = $path;

    // @version 1.3.2 Rename file to add ext if ext is missing
    if (!$this->ext()) {
        $this->rename();
    }

    // @version 1.4.0 Reset the cache
    $this->_cache = array();
}
[...]
4

1 回答 1

1

你错了composer.json。您提到的是名为“mjohnson/transit”的库 - 如果您没有开发这个确切的软件,那么这是错误的。

您应该创建一个至少包含以下行的新 composer.json 文件:

{ "require": { "mjohnson/transit" : "*" } }

然后运行composer install

我不知道您为获取该composer.json文件做了什么,但如果您最初克隆了另一个存储库,然后现在编辑该文件,事情就会中断!备份您的代码(如果有)。尝试在不撤消您自己的代码的情况下撤消您做错的事情。

于 2013-11-01T10:34:49.437 回答