Context
I'm currently working on an OroPlatform project, which is based on Symfony 4.4 and deployed on Platform.sh.
I'm facing the following issue during the build phase of the deployment:
My app needs the package symfony/process 4.4.X
I don't know why, but on the Platform.sh server my app uses the symfony/process package installed for the composer binary installed globally, but this one is a 5.X version
So, I've got an error and I can't install my app because it uses the 5.X version instead of the 4.X
That's why I've found a workaround by using Composer 1.9.3 because it uses symfony/process 4.4.X, the same used by my app.
It was working well, but yesterday I have to bump the composer version to latest 1.X due to the Github OAuth token changes: https://nono.ma/github-oauth-token-for-github-com-contains-invalid-characters-on-composer-install
Issue
So, I'm still facing this issue with the 4.X version and the 5.X version.
I've tried to install the dependencies of my project this way : composer install -n -o -a but the bug still occurs.
I'm looking for a way to force my project to use the dependencies located in the vendor folder of my app and not the ones installed globally. Here is a screenshot of the issue on the Platform.sh server:
And here is a schema of the path of my app and composer on a Platform.sh server:
/app
|
|__/vendor/symfony-process
|
|__/.global/vendor/symfony-process
My composer.json:
{
"name": "oro/platform-application",
"description": "Oro Platform Empty Application",
"homepage": "https://github.com/oroinc/platform-application.git",
"license": "MIT",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"src/AppKernel.php",
"src/AppCache.php",
"vendor/oro/platform/guzzle/Client.php"
],
"exclude-from-classmap": [
"/vendor/guzzle/guzzle/src/Guzzle/Http/Client.php",
"**/Tests/"
]
},
"repositories": {
"composer": {
"type": "composer",
"url": "https://packagist.orocrm.com"
}
},
"require": {
"php": "~7.3.13 || ~7.4.2",
"oro/platform": "4.1.*",
"oro/platform-serialised-fields": "4.1.*",
"oro/oauth2-server": "4.1.*",
"doctrine/doctrine-migrations-bundle": "^3.0"
},
"require-dev": {
"behat/behat": "3.4.*",
"behat/gherkin": "4.6.0",
"behat/mink": "dev-master#6d637f7af4816c26ad8a943da2e3f7eef1231bea",
"behat/mink-extension": "2.3.*",
"behat/mink-selenium2-driver": "1.3.1",
"behat/symfony2-extension": "2.1.*",
"guzzlehttp/guzzle": "^6.0.0",
"nelmio/alice": "3.6.*",
"theofidry/alice-data-fixtures": "1.0.*",
"phpunit/phpunit": "7.5.*",
"johnkary/phpunit-speedtrap": "3.0.*",
"mybuilder/phpunit-accelerator": "dev-master",
"squizlabs/php_codesniffer": "3.5.*",
"phpmd/phpmd": "2.6.*",
"sebastian/phpcpd": "4.0.*",
"phpunit/phpcov": "5.0.*",
"symfony/phpunit-bridge": "4.4.*",
"friendsofphp/php-cs-fixer": "2.16.*",
"oro/twig-inspector": "1.0.*"
},
"config": {
"component-dir": "public/bundles/components",
"bin-dir": "bin",
"fxp-asset": {
"enabled": false
}
},
"scripts": {
"post-install-cmd": [
"#build-parameters",
"#set-permissions",
"#install-assets",
"#set-assets-version"
],
"post-update-cmd": [
"#build-parameters",
"#set-permissions",
"#update-assets",
"#set-assets-version"
],
"build-parameters": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
],
"set-permissions": [
"Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setPermissions"
],
"install-assets": [
"Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::installAssets"
],
"update-assets": [
"Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::updateAssets"
],
"set-assets-version": [
"Oro\\Bundle\\InstallerBundle\\Composer\\ScriptHandler::setAssetsVersion"
],
"set-parameters": [
"Oro\\Bundle\\InstallerBundle\\Composer\\ParametersHandler::set"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"symfony": {
"require": "4.4.*"
},
"symfony-web-dir": "public",
"symfony-var-dir": "var",
"symfony-bin-dir": "bin",
"symfony-tests-dir": "tests",
"incenteev-parameters": {
"file": "config/parameters.yml"
}
}
}
Finally I've supposed that installing composer under the same folder as the web application don't seems to be a good practise. Moreover, it seems that Platform.sh don't use the composer binary.
So, I have change the build phase inside my .platform.app.yaml to avoid the way Platform.sh install Composer and use a custom way to do it:
# .platform.app.yaml
hooks:
build: |
set -e
cd $PLATFORM_APP_DIR
# install Composer
chmod +x composer-install.sh
./composer-install.sh
# composer-install.sh
#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --1 --quiet
RESULT=$?
rm composer-setup.php
>&1 echo 'Composer successfully installed'
exit $RESULT
Try installing the package, so it will be added to your composer.json file.
composer install symfony/process
The following section will cause the correct version to be installed
"extra": {
"symfony": {
"require": "4.4.*"
},
Once you've run the command, the package should be added as follows :
"symfony/process": "4.4.*"
If it does not, change it to that version number and run
composer update symfony/process
Related
I'm trying to start a new symfony --version=5.2 project, and before everything else I'm installing the symfony maker bundle, but I get this error which I can't find no solution for it.
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^1.43 for symfony/maker-bundle
./composer.json has been updated
Running composer update symfony/maker-bundle
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires symfony/maker-bundle ^1.43 -> satisfiable by symfony/maker-bundle[v1.43.0].
- symfony/maker-bundle v1.43.0 requires symfony/config ^5.4.7|^6.0 -> found symfony/config[v5.4.7, v5.4.8, v5.4.9, v6.0.0, ..., v6.1.0] but the package is fixed to v5.2.12 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require symfony/maker-bundle:*" to figure out if any version is installable, or "composer require symfony/maker-bundle:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
I tried changing the maker-bundle version myself but still got the same error.
I tried to search for similar problems but no luck finding this error.
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.6",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.12",
"symfony/console": "5.2.*",
"symfony/dotenv": "5.2.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "5.2.*",
"symfony/http-client": "5.2.*",
"symfony/proxy-manager-bridge": "5.2.*",
"symfony/yaml": "5.2.*"
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"symfony/flex": true
},
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"docker": false,
"require": "5.2.*"
}
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "5.2.*",
"symfony/css-selector": "5.2.*",
"symfony/phpunit-bridge": "^6.1"
}
}
I have freshly installed drupal 9.
composer.json
{
"name": "drupal/drupal",
"description": "Drupal is an open source content management platform powering millions of websites and applications.",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"require": {
"composer/installers": "^1.9",
"drupal/core": "self.version",
"drupal/core-project-message": "self.version",
"drupal/core-vendor-hardening": "self.version"
},
"require-dev": {
"behat/mink": "^1.8",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"behat/mink-goutte-driver": "^1.2",
"behat/mink-selenium2-driver": "^1.4",
"composer/composer": "^2.0.2",
"drupal/coder": "^8.3.10",
"fabpot/goutte": "^3.3",
"instaclick/php-webdriver": "^1.4.1",
"mikey179/vfsstream": "^1.6.8",
"phpunit/phpunit": "^8.5.14 || ^9",
"phpspec/prophecy": "^1.12",
"symfony/css-selector": "^4.4",
"symfony/phpunit-bridge": "^5.3.0",
"symfony/var-dumper": "^5.3.0",
"symfony/error-handler": "^4.4",
"justinrainbow/json-schema": "^5.2",
"symfony/filesystem": "^4.4",
"symfony/finder": "^4.4",
"symfony/lock": "^4.4",
"symfony/browser-kit": "^4.4",
"symfony/dom-crawler": "^4.4 !=4.4.5",
"easyrdf/easyrdf": "^0.9 || ^1.0"
},
"replace": {
"paragonie/random_compat": "9.99.99",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"preferred-install": "dist",
"autoloader-suffix": "Drupal9",
"platform": {
"php": "7.3.0"
}
},
"extra": {
"_readme": [
"By default Drupal loads the autoloader from ./vendor/autoload.php.",
"To change the autoloader you can edit ./autoload.php.",
"This file specifies the packages.drupal.org repository.",
"You can read more about this composer repository at:",
"https://www.drupal.org/node/2718229"
],
"installer-paths": {
"core": ["type:drupal-core"],
"libraries/{$name}": ["type:drupal-library"],
"modules/contrib/{$name}": ["type:drupal-module"],
"profiles/contrib/{$name}": ["type:drupal-profile"],
"themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/contrib/{$name}": ["type:drupal-drush"],
"modules/custom/{$name}": ["type:drupal-custom-module"],
"themes/custom/{$name}": ["type:drupal-custom-theme"]
},
"drupal-core-project-message": {
"post-install-cmd-message": [
"<bg=blue;fg=white>drupal/drupal</>: This package is meant for core development,",
" and not intended to be used for production sites.",
" See: https://www.drupal.org/node/3082474"
],
"post-create-project-cmd-message": [
"<bg=red;fg=white>drupal/drupal</>: This package is meant for core development,",
" and not intended to be used for production sites.",
" See: https://www.drupal.org/node/3082474"
]
}
},
"autoload": {
"psr-4": {
"Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
}
},
"autoload-dev": {
"psr-4": {
"Drupal\\Composer\\": "composer"
}
},
"scripts": {
"pre-install-cmd": "Drupal\\Composer\\Composer::ensureComposerVersion",
"pre-update-cmd": "Drupal\\Composer\\Composer::ensureComposerVersion",
"pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
"drupal-phpunit-upgrade-check": "Drupal\\Core\\Composer\\Composer::upgradePHPUnit",
"drupal-phpunit-upgrade": [
"#composer update phpunit/phpunit --with-dependencies --no-progress",
"#composer require phpspec/prophecy-phpunit:^2 --no-progress --no-suggest"
],
"post-update-cmd": [
"Drupal\\Composer\\Composer::generateMetapackages"
],
"phpcs": "phpcs --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --",
"phpcbf": "phpcbf --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --"
},
"repositories": [
{
"type": "path",
"url": "core"
},
{
"type": "path",
"url": "composer/Plugin/ProjectMessage"
},
{
"type": "path",
"url": "composer/Plugin/VendorHardening"
},
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
]
}
I have read it is best to use composer for installign modules. So I am trying
php8.0 /usr/local/bin/composer require drupal/google_analytics
Using version ^3.1 for drupal/google_analytics
./composer.json has been updated
Running composer update drupal/google_analytics
> Drupal\Composer\Composer::ensureComposerVersion
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- drupal/google_analytics[dev-3.x, 3.1.0] require drupal/core ^8.8.6|^9.0 -> satisfiable by drupal/core[8.8.6, ..., 8.9.x-dev, 9.0.0-alpha1, ..., 9.3.x-dev] from composer repo (https://repo.packagist.org) but drupal/core[dev-main] from path repo (core) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
- drupal/google_analytics 3.x-dev is an alias of drupal/google_analytics dev-3.x and thus requires it to be installed too.
- Root composer.json requires drupal/google_analytics ^3.1 -> satisfiable by drupal/google_analytics[3.1.0, 3.x-dev (alias of dev-3.x)].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
How to understand those errors? Looks like it requires drupal 8 or 9 but i have 9 so why there is a problem? I see there is mentioned priorities, I have read https://getcomposer.org/doc/articles/repository-priorities.md but I do not get what I need to fix for it to work. Can you tell?
Deleted vendor directory. Ran composer install. Noticed message after installation
drupal/drupal: This package is meant for core development,
and not intended to be used for production sites.
See: https://www.drupal.org/node/3082474
Packages already clean.
In the link I saw composer command to create new project, so I modified it to this one and tried:
composer -n create-project drupal/recommended-project:* drupal3
then followed installation steps https://www.drupal.org/docs/installing-drupal
and then tried installing google analytics - and it went without problems.
I have a Symfony 3.4 project I'm trying to upgrade to 4.x with Flex but I'm falling at the first hurdle.
With the output of Composer this verbose I assume the answer is staring me straight in the face, but I'm not seeing it. What do I need to do? I've deleted everything in vendor, deleted my composer.lock file, cleared composer cache, etc.
composer.json
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"sensio/framework-extra-bundle": "^5.5",
"symfony/console": "4.4.*",
"symfony/dotenv": "4.4.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "4.4.*",
"symfony/monolog-bundle": "^3.5",
"symfony/orm-pack": "^1.0",
"symfony/profiler-pack": "^1.0",
"symfony/twig-pack": "^1.0",
"symfony/yaml": "4.4.*",
"friendsofsymfony/jsrouting-bundle": "^2.5",
"friendsofsymfony/user-bundle": "~2.0",
"stof/doctrine-extensions-bundle": "^1.3",
"symfony/swiftmailer-bundle": "^2.6.4",
"ext-json": "*"
},
"require-dev": {
"symfony/debug-pack": "^1.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.19",
"phpstan/phpstan-doctrine": "^0.12.10",
"phpunit/phpunit": "^7.5",
"symfony/phpunit-bridge": "^3.0"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
}
}
}
Tried to composer install with:
php -d memory_limit=-1 /usr/local/bin/composer install
And it spews all this out (too big to paste here): https://pastebin.com/KLVRkYdF
Saw something elsewhere about needing to install Flex on its own first, so I tried this:
php -d memory_limit=-1 /usr/local/bin/composer update symfony/flex --no-plugins --no-scripts
But got the following error (too big to paste here): https://pastebin.com/KxG2siZi
The problem is that you haven't updated symfony/swiftmailer-bundle - as given in the composer.json, you tried to install at most v2.6.7 which requires symfony/http-kernelin v2.7 or v3.x. This is not compatible with symfony/framework-bundle in v4.4, as this requires symfony/http-kernel to be of that same v4.4 branch.
Conclusion: also update symfony/swiftmailer-bundle to at least v3.1 which is the first one to be compatible with Symfony v4.
I also had a lot of issues with composer, packageversions and memory limits in the past.
Package vesions:
Set all symfony packages to the version "*" if yout dont require a specific Version at this point. Thisway composer will select the one suitable to your configured symfony version.
Memory limit:
Which IDE are you using? Which PHP Version? 32 or 64 bit? Try running the commany outside of the IDE and see what happens. Alternatively try the symfony command.
When i do composer update on my Laravel 5.1 it come out with this error
> Downloading http://packagist.org/p/symfony/polyfill-mbstring$a9a5f6e4a8af44008f50a8c0059a6d1a61b1f692627fb41f0cc1f3e8bbfb7205.json
> Writing /root/.composer/cache/repo/https---packagist.org/provider-symfony$polyfill-mbstring.json into cache
[RuntimeException]
Could not load package shopware/shopware in http://packagist.org: [UnexpectedValueException] Could not parse version constraint ~v
2.0.0-rc1: Invalid version string "~v2.0.0-rc1"
[UnexpectedValueException]
Could not parse version constraint ~v2.0.0-rc1: Invalid version string "~v2.0.0-rc1"
when i trace it on cache folder
"require-dev": {
"phpunit\/phpunit": "~4.5",
"phpunit\/dbunit": "~1.3",
"behat\/mink": "~1.7",
"behat\/mink-extension": "~2.1",
"behat\/mink-goutte-driver": "~1.2",
"behat\/mink-selenium2-driver": "~1.3",
"symfony\/dom-crawler": "~2.8",
"behat\/behat": "~3.1",
"sensiolabs\/behat-page-object-extension": "~v2.0.0-rc1"
},
it is on not on my require package : composer.json
it is from symfony/polyfill-mbstring
but why on json file they got this?
"packages": {
"shopware\/shopware": {
"5.2.x-dev": {
"name": "shopware\/shopware",
"description": "Shopware is the next generation of open source e-commerce software made in Germany",
"keywords": ["shop", "shopware"],
"homepage": "http:\/\/www.shopware.com",
"version": "5.2.x-dev",
"version_normalized": "5.2.9999999.9999999-dev",
"license": ["AGPL-3.0", "proprietary"],
"authors": [],
"source": {
"type": "git",
"url": "https:\/\/github.com\/shopware\/shopware.git",
"reference": "4c4817979a98144e57d9eebc5aa166795e378a1c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/shopware\/shopware\/zipball\/4c4817979a98144e57d9eebc5aa166795e378a1c",
"reference": "4c4817979a98144e57d9eebc5aa166795e378a1c",
"shasum": ""
},
"type": "project",
"time": "2016-03-29T06:54:10+00:00",
"autoload": {
"psr-0": {
"Doctrine\\Common\\Proxy\\AbstractProxyFactory": "engine\/Library\/",
"Doctrine\\ORM\\Persisters\\Entity\\BasicEntityPersister": "engine\/Library\/",
"Shopware": "engine\/",
"Enlight": "engine\/Library\/",
"Zend": "engine\/Library\/",
"JSMin": "engine\/Library\/minify\/"
},
"classmap": ["engine\/Shopware\/Core\/"],
"files": ["engine\/Shopware\/Application.php"]
},
"include-path": ["engine\/Library\/"],
"require": {
"php": ">=5.5.9",
"ext-curl": "*",
"ext-mbstring": "*",
"ext-gd": "*",
"doctrine\/common": "2.5.1",
"doctrine\/dbal": "2.5.1",
"doctrine\/orm": "2.5.1",
"beberlei\/assert": "2.4.0",
"zendframework\/zend-escaper": "2.5.1",
"oyejorge\/less.php": "1.7.0.5",
"guzzlehttp\/guzzle": "5.1.0",
"egulias\/email-validator": "1.2.9",
"symfony\/http-kernel": "2.8.0",
"symfony\/config": "2.8.0",
"symfony\/dependency-injection": "2.8.0",
"symfony\/validator": "2.8.0",
"symfony\/filesystem": "2.8.0",
"symfony\/finder": "2.8.0",
"symfony\/console": "2.8.0",
"symfony\/polyfill-php56": "1.0.0",
"monolog\/monolog": "1.17.2",
"doctrine\/cache": "1.6.0",
"paragonie\/random_compat": "1.1.5",
"symfony\/form": "2.8.0",
"league\/flysystem": "1.0.18",
"elasticsearch\/elasticsearch": "2.1.5",
"ongr\/elasticsearch-dsl": "v2.0.0"
},
"require-dev": {
"phpunit\/phpunit": "~4.5",
"phpunit\/dbunit": "~1.3",
"behat\/mink": "~1.7",
"behat\/mink-extension": "~2.1",
"behat\/mink-goutte-driver": "~1.2",
"behat\/mink-selenium2-driver": "~1.3",
"symfony\/dom-crawler": "~2.8",
"behat\/behat": "~3.1",
"sensiolabs\/behat-page-object-extension": "~v2.0.0-rc1"
},
"replace": {
"symfony\/polyfill-php55": "~1.0",
"symfony\/polyfill-mbstring": "~1.0"
},
"uid": 588566
}, bla ...............
I've had exact same error
./composer.phar selfupdate solve the problem, for me.
Seems to be a problem with composer itself, we had the same problem with our global composer.
You will need to clear the cache and vendor maps in /root/.composer/ and update composer itself:
cd /root
curl -sS https://getcomposer.org/installer | sudo php --
php composer.phar global update
rm composer.phar
This is not an issue in Composer but with the Shopware upstream packages.
The following commit broke this dependency on March 29th:
https://github.com/shopware/shopware/commit/e44e4a7d788675489aadbd664c50a7cfc47e0f05
The following commit fixed it a day later:
https://github.com/shopware/shopware/commit/0cec1d69e972150b3d1fa71b82e621031ff341e3
So if you are still experiencing this issue use the following commands to fix:
composer clear-cache
composer update shopware/shopware
At first, sorry for stupid question but I'm new in Heroku as in Symfony. I'm learning Symfony and now trying to deploy my app to Heroku. But after push to heroku I have error I can't solve. I searched for answers but didn't find the solution. My enviroment is switched to PROD. Here is bunch of files I think can be usefull to analyze.
Initializing repository, done.
Counting objects: 8783, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (7959/7959), done.
Writing objects: 100% (8783/8783), 6.34 MiB | 499.00 KiB/s, done.
Total 8783 (delta 2737), reused 0 (delta 0)
-----> PHP app detected
-----> Resolved composer.lock requirement for PHP >=5.3.3 to version 5.6.2.
-----> Installing system packages...
- PHP 5.6.2
- Apache 2.4.10
- Nginx 1.6.0
-----> Installing PHP extensions...
- zend-opcache (automatic; bundled, using 'ext-zend-opcache.ini')
-----> Installing dependencies...
Composer version 1.0-dev (a309e1d89ded6919935a842faeaed8e888fbfe37) 2014-10-20 19:16:14
! WARNING: You have put Composer's vendor directory under version control.
That directory should not be in your Git repository; only composer.json
and composer.lock should be added, with Composer handling installation.
Please 'git rm --cached vendor/' to remove the folder from your index,
then add '/vendor/' to your '.gitignore' list to remove this notice.
For more information, refer to the Composer FAQ: http://bit.ly/1rlCSZU
Loading composer repositories with package information
Installing dependencies from lock file
- Removing sensio/generator-bundle (v2.4.0)
Generating optimized autoload files
Updating the "app/config/parameters.yml" file
PHP Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /tmp/build_a721f054a4c0177a8e4e060c5b747b1c/app/AppKernel.php on line 26
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]
! Push rejected, failed to compile PHP app
Here is composer.json content:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"sensio/generator-bundle": "~2.4"
},
"require-dev": {
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
}
}
and AppKernel.php content:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Irishdash\StorageBundle\IrishdashStorageBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
You want to run heroku config:set SYMFONY_ENV=prod before you push, otherwise the post-install-cmd scripts will run in the dev environment, which needs the generator bundle, but that one is not available as Heroku only installs packages from require, not from require-dev, during a push (using Composer's --no-dev mode).
First of all, please follow the instructions received in the warning by Heroku.
Please 'git rm --cached vendor/' to remove the folder from your index,
then add '/vendor/' to your '.gitignore'
Then commit the changes for the .gitignore file to Git.
Next, it's installing dependencies from the lock file, but looks like you've moved the sensio/generator-bundle package to require from require-dev.
Given this, try running php composer.phar update and then commit the changes for the composer.lock file to Git.
Also you may need composer.lock file in your app