1

I recently updated my CraftCMS 3 with the help of Composer.

When I try to install a plugin with the plugin store, I get an error saying that Craft couldn't find my composer.json file. He proposes me to define the CRAFT_COMPOSER_PATH in index.php. But, when I do, I still get the same error.

My composer.json is the root of craft folder. I seriously don't know how to solve my problem.

Here's a screenshot (sorry I use Craft in french):

enter image description here

Thank you!

6
  • in root plugin folder has file composer.json? Nov 14 '19 at 17:39
  • I am not sure I understand. I don't have a Plugin folder at the root because Craft 3.3.15 doesn't have a plugin folder.
    – Mikko109
    Nov 14 '19 at 17:47
  • /vendor/pluginName/composer.json Nov 14 '19 at 17:49
  • I see what you mean. But I can't access that if the plugin I want is not installed. The plugin store won't install the plugin I want because it can't find my root composer.json.
    – Mikko109
    Nov 14 '19 at 17:57
  • follow this tutorial: docs.craftcms.com/v3/config/php-constants.html Nov 14 '19 at 18:12
1

You need to open your index.php file and add composer path line. E.g. my composer.json file is placed in root folder and I defined below path inside my index.php:

    <?php
 
//Project root path
$root = dirname(__DIR__);
 
 
// Load and run Craft
define('CRAFT_BASE_PATH', $root.'/craft');
define('CRAFT_COMPOSER_PATH', $root.'/composer.json'); <======= this line
require_once $root.'/vendor/autoload.php';
$app = require $root.'/vendor/craftcms/cms/bootstrap/web.php';
$app->run();

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.