【问题标题】:SilverStripe 3.0 upgrade to 3.1 failure with ComposerSilverStripe 3.0 使用 Composer 升级到 3.1 失败
【发布时间】:2015-09-30 15:38:07
【问题描述】:

我以前从未升级过 SilverStripe 项目,如果我遗漏了任何明显的内容,请见谅。

我想将我在本地运行的这个 3.0.5 SilverStripe 站点升级到最新版本(即 3.1.6 或类似版本)。我更新了我的 composer.json 文件(位于 [项目名称]/cms/composer.json 的项目中),使其看起来像这样:

{
"name": "silverstripe/cms",
"type": "silverstripe-module",
"description": "The SilverStripe Content Management System",
"homepage": "http://silverstripe.org",
"license": "BSD-3-Clause",
"keywords": ["silverstripe", "cms"],
"authors": [
    {
        "name": "SilverStripe",
        "homepage": "http://silverstripe.com"
    },
    {
        "name": "The SilverStripe Community",
        "homepage": "http://silverstripe.org"
    }
],
"require": {
    "php": ">=5.3.2",
    "composer/installers": "*",
    "silverstripe/cms": "3.1.*",
    "silverstripe/framework": "3.1.*"
},
"autoload": {
    "classmap": ["tests/behat/"]
}

}

当终端提示我这样做时,我还更新了作曲家本身。

我去了 composer.json 文件所在的位置,在终端运行 composer update 并得到这个错误:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: silverstripe/cms[3.1.0, dev-master].
    - Can only install one of: silverstripe/cms[3.1.1, dev-master].
    - Can only install one of: silverstripe/cms[3.1.10, dev-master].
    - Can only install one of: silverstripe/cms[3.1.11, dev-master].
    - Can only install one of: silverstripe/cms[3.1.12, dev-master].
    - Can only install one of: silverstripe/cms[3.1.13, dev-master].
    - Can only install one of: silverstripe/cms[3.1.14, dev-master].
    - Can only install one of: silverstripe/cms[3.1.15, dev-master].
    - Can only install one of: silverstripe/cms[3.1.2, dev-master].
    - Can only install one of: silverstripe/cms[3.1.3, dev-master].
    - Can only install one of: silverstripe/cms[3.1.4, dev-master].
    - Can only install one of: silverstripe/cms[3.1.5, dev-master].
    - Can only install one of: silverstripe/cms[3.1.6, dev-master].
    - Can only install one of: silverstripe/cms[3.1.7, dev-master].
    - Can only install one of: silverstripe/cms[3.1.8, dev-master].
    - Can only install one of: silverstripe/cms[3.1.9, dev-master].
    - Installation request for silverstripe/cms dev-master -> satisfiable by silverstripe/cms[dev-master].
    - Installation request for silverstripe/cms 3.1.* -> satisfiable by silverstripe/cms[3.1.0, 3.1.1, 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.14, 3.1.15, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9].

我是否需要具体说明我需要更新到哪个版本的 SilverStripe?我没有在项目中看到 composer.lock 文件,但我确实删除了 web.config 中调用一个的行:

<add segment="composer.lock" />

composer.json 文件是否应该位于项目的其他位置(而不是 [项目名称]/cms)?

更新:在根目录中安装了 composer 并在其中放置了一个 composure.json 文件,当我尝试将站点升级到 SilverStripe 3.1 时,我仍然遇到错误:

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Updating composer/installers dev-master (v1.0.2 => e420b53)



  [RuntimeException]
  The .git directory is missing from /Projects/[project name]/vendor/composer/installers, see https://getcomposer.org/commit-deps for more information



update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]


 ~/Projects/[project name] $ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Updating silverstripe/framework (3.0.x-dev 29de643 => 3.1.x-dev 92970f8)



  [RuntimeException]
  The .git directory is missing from framework/, see https://getcomposer.org/commit-deps for more information



install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [packages1] ... [packagesN]

【问题讨论】:

    标签: composer-php silverstripe


    【解决方案1】:

    您不应该编辑 cms/composer.json,您应该在项目的根目录下编辑 composer.json(如果存在 - 如果之前的开发人员没有,则可能没有 composer.json' t 与作曲家一起安装)。

    【讨论】:

    • 我可以将composer安装到项目的根目录吗?
    • @SaraDeJaneiro 您可以在根级别创建一个 composer.json,如果那里还没有的话,是的。
    • 好的,我会试试的...我不知道之前的开发者做了什么。我也不能问,因为他不再在这里工作了。
    • @SaraDeJaneiro 在升级到 SS 3.1 时要小心,因为从 3.0 到 3.1 的跳转不符合 SemVer(该项目从 3.2 开始采用 SemVer)。由于这些版本之间 API 的更改,您可能必须对代码库进行一些手动更新。查看github.com/sunnysideup/silverstripe-upgrade_silverstripe 了解可以帮助完成此过程的工具。
    • 我现在已经在根目录下安装了 composer,并且我有一个 composer.json 文件。但我不断收到错误。我更新了我的帖子以包含这些
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-17
    • 2020-04-22
    • 2016-07-02
    相关资源
    最近更新 更多