使用Composer

时间:2015-09-30 15:38:07

标签: composer-php silverstripe

我以前从未升级过SilverStripe项目,所以请原谅我,如果我错过任何明显的事情。

我想将我在本地运行的3.0.5 SilverStripe站点升级到最新版本(3.1.6或类似版本)。我更新了我的composer.json文件(位于[project name] /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]

1 个答案:

答案 0 :(得分:5)

您不应该编辑cms / composer.json,您应该在项目的根目录下编辑composer.json(如果有一个存在 - 如果以前的开发人员没有&#可能没有composer.json 39;用作曲家安装。)