1

I'm trying to install a non-current version of Craft 3, and several pointers on using composer to do this say to "update the composer.json" line with the version you want.

Can someone please explain exactly where this file should be, and/or the steps to do this, as I cannot make head-nor-tail of this process.

Where can I download previous versions of Craft?

https://craftcms.com/knowledge-base/downloading-previous-commerce-versions

0
  1. Make sure you have Composer installed from the command line.
  2. Open your project's composer.json file.
  3. Find the "require" section. Similar to:
"require": {
    "craftcms/cms": "^3.6.4",
    "vlucas/phpdotenv": "^3.4.0"
},
  1. Edit the craftcms/cms line to the exact version you want. For example 3.5.0.
"craftcms/cms": "3.5.0",
  1. Run composer update from the CLI from your project's root and that will pull in a fresh set to Craft 3.5.0 files.
7
  • Thanks for engaging an answer... I'm still confused. I've installed it locally, but I don't see a composer.json file anywhere?
    – RocksaltAU
    Apr 20 at 0:10
  • @RocksaltAU You should be able to find the composer.json file at the root of your project. It’s a required file and there’s no way you wouldn’t have one, unless someone manually deleted it accidentally. If you don’t have it, you can use this as a starting point (but rename it to lose the .default). You’ll need to reinstall all of your plugins after you run composer update using that file, though. Apr 20 at 2:09
  • I have done this, but when I launched the setup, it still upgraded to the lastest version of craft. I must be triggering the setup process incorrectly? -- actually, I've downloaded the version of craft cms into a folder, but the composer.json doesn't have the require craftcms/cms line at all. It simply has a version number at the top of json.
    – RocksaltAU
    Apr 22 at 0:44
  • Can you share a screenshot of your composer.json file?
    – Brad Bell
    Apr 22 at 23:27
  • { "name": "craftcms/cms", "description": "Craft CMS", "version": "3.6.7", "keywords": [ "cms", "craftcms", "yii2" ], "homepage": "https://craftcms.com", "license": "proprietary", "support": { "email": "support@craftcms.com", "issues": "https://github.com/craftcms/cms/issues?state=open", "forum": "https://craftcms.stackexchange.com/", "source": "https://github.com/craftcms/cms", "docs": "https://craftcms.com/docs/3.x/", "rss": "https://github.com/craftcms/cms/releases.atom" }, "require": { "php": ">=7.2.5",
    – RocksaltAU
    Apr 22 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.