MagentoFrameworkComposerComposerJsonFinder::findComposerJson() expects the root composer.json file to always be one directory higher than vendor folder. However this is not true when a custom vendor-dir is specified.
Either this method is adjusted to work with any vendor-dir location or you should inform that a custom vendor-dir is not supported.
Regards
@jalogut Are you using Composer to deploy Magento? Currently custom vendor directory support is only available in develop branch of the git repo. It will be included in Composer deployed Magento in future versions.
@eddielau Yes, I am using composer to deploy Magento but I am using latest official 2.0.2. I will git it a try with develop branch and let you know.
@jalogut
Do you have any update for this issue?
Hello @andimov ,
I just tested it on version 2.1.0 and now there is a different issue:
Composer file not found#0 /Volumes/workspace/krieger-test/magento/vendor/magento/framework/Composer/ComposerFactory.php(48): Magento\Framework\Composer\ComposerJsonFinder->findComposerJson()
That comes from the following function on MagentoFrameworkAppFilesystemDirectoryListComposerJsonFinder:
/**
* Find absolute path to root Composer json file
*
* @return string
* @throws \Exception
*/
public function findComposerJson()
{
$composerJson = $this->directoryList->getPath(DirectoryList::ROOT) . '/composer.json';
$composerJson = realpath($composerJson);
if ($composerJson === false) {
throw new \Exception('Composer file not found');
}
return $composerJson;
}
As you can see on the first line, the function is now looking for the composer file on the Magento root. This is not right if we set a different magento-root-dir on the composer-installer config:
"extra": {
"magento-root-dir": "magento/",
},
For now I just use a work around that symlinks the expected composer files on the Magento root:
"scripts": {
"post-install-cmd": [
"cd magento && ln -sf ../composer.* ."
]
"post-update-cmd": [
"cd magento && ln -sf ../composer.* ."
]
}
Should I open a different issue for that?
Thanks
@jalogut thank you for update.
Yes, please create another issue for another problem.
Please, format it according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.
If original issue is not actual anymore please close this one.
According to contributor guide, tickets without response for two weeks should be closed.
If this issue still reproducible please feel free to create the new one: format new issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result and specify Magento version.
i faced this problem when i used dockergento
solution:
$ dockergento down // stop all containers
$dockergento start //run all containers
the problem has been solved.
Most helpful comment
i faced this problem when i used dockergento
solution:
$ dockergento down // stop all containers
$dockergento start //run all containers
the problem has been solved.