1
votes

I've never upgraded a SilverStripe project before, so forgive me if I'm missing anything obvious.

I want to upgrade this 3.0.5 SilverStripe site I have running locally to the latest version (which is 3.1.6 or something similar). I updated my composer.json file (which is located within the project in [project name]/cms/composer.json) to look as such:

{
"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/"]
}

}

I also updated composer itself as I was prompted to do so in the terminal.

I went to the where the composer.json file is located, ran composer update in the terminal and got this error:

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].

Do I need to be specific as to which version of SilverStripe I need to update to? I didn't see a composer.lock file in the project, but I did remove a line in web.config that was calling to one:

<add segment="composer.lock" />

Should the composer.json file be located elsewhere in the project (as opposed to [project name]/cms)?

UPDATE: With composer installed in the root directory and a composure.json file located there, I still get errors when trying to upgrade the site to 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

1 Answers

5
votes

You shouldn’t be editing cms/composer.json, you should be editing the composer.json at the root of your project (if there is one present - there may not be a composer.json if the previous developer didn't install with composer).