2

我在本地运行 composer 以生成必要的文件,然后将这些文件单独部署到服务器。因此我正在运行:

composer require phpoffice/phpspreadsheet --ignore-platform-reqs

但是,它失败了:

Problem 1
    - The requested package phpoffice/phpspreadsheet No version set (parsed as 1.0.0) is satisfiable by phpoffice/phpspreadsheet[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.

我对作曲家不熟悉。我已经通过添加到 composer.json 尝试了这里建议的解决方案https://github.com/google/google-api-php-client/issues/971"phpoffice/phpspreadsheet":"^1.0",但这没有用。我也尝试过将最低稳定性设置为dev没有运气。

有人可以帮忙吗?

编辑更多信息***

我安装了 PHP 7.2,完整的 .json 与https://github.com/PHPOffice/PhpSpreadsheet提供的相同

这里:

{
    "name": "phpoffice/phpspreadsheet",
    "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
    "keywords": ["PHP", "OpenXML", "Excel", "xlsx", "xls", "ods", "gnumeric", "spreadsheet"],
    "homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
    "type": "library",
    "license": "LGPL-2.1-or-later",
    "authors": [
        {
            "name": "Maarten Balliauw",
            "homepage": "http://blog.maartenballiauw.be"
        },
        {
            "name": "Mark Baker",
            "homepage": "http://markbakeruk.net"
        },
        {
            "name": "Franck Lefevre",
            "homepage": "http://rootslabs.net"
        },
        {
            "name": "Erik Tilt"
        }
    ],
    "scripts": {
        "check": [
            "php-cs-fixer fix --ansi --dry-run --diff",
            "phpcs --report-width=200 --report-summary  --report-full samples/ src/ tests/ --ignore=samples/Header.php --standard=PSR2 -n",
            "phpunit --color=always"
        ],
        "fix": [
            "php-cs-fixer fix --ansi"
        ]
    },
      "require": {
        "php": "^5.6|^7.0",
        "ext-ctype": "*",
        "ext-dom": "*",
        "ext-gd": "*",
        "ext-iconv": "*",
        "ext-libxml": "*",
        "ext-mbstring": "*",
        "ext-SimpleXML": "*",
        "ext-xml": "*",
        "ext-xmlreader": "*",
        "ext-xmlwriter": "*",
        "ext-zip": "*",
        "ext-zlib": "*",
        "psr/simple-cache": "^1.0"
    },
    "require-dev": {
        "tecnickcom/tcpdf": "^6.2",
        "squizlabs/php_codesniffer": "^2.7",
        "phpunit/phpunit": "^5.7",
        "dompdf/dompdf": "^0.8.0",
        "mpdf/mpdf": "^7.0.0",
        "jpgraph/jpgraph": "^4.0",
        "friendsofphp/php-cs-fixer": "@stable"
    },
    "suggest": {
        "mpdf/mpdf": "Option for rendering PDF with PDF Writer",
        "dompdf/dompdf": "Option for rendering PDF with PDF Writer",
        "tecnick.com/tcpdf": "Option for rendering PDF with PDF Writer",
        "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers"
    },
    "autoload": {
        "psr-4": {
            "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests"
        }
    }
}
4

1 回答 1

4

好的,所以这个答案适用于其他任何发现这是作曲家新手的人:

我假设作曲家会访问我已经从 GIT 下载的本地文件来配置所有内容。所以我从库源目录中运行 composer 命令。

这不是它的工作方式。您需要从项目目录中运行 composer 命令,它将通过 Internet 拉取文件并将它们“安装”到您的项目目录结构中。

于 2018-02-22T08:58:21.020 回答