composer: Install composer on Jenkins: Composer could not find the config file: C:\ProgramData\ComposerSetup\bin
I have an Ant build script that is trying to execute Composer install but I get this error when executed through Jenkins:
[exec] Composer could not find the config file: C:\ProgramData\ComposerSetup\bin
[exec] To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
[exec] Result: 1
[echo] composer update complete
Here is the target from Ant:
<target name="self-update"
if="composer.self-update"
unless="composer.installed"
description="Self-update Composer">
<echo message="Self-updating composer" level="debug"/>
<exec executable="${composer.phar}">
<arg value="self-update" />
<arg value="--quiet" />
<arg value="--no-interaction" />
</exec>
<echo message="composer self-update complete" level="debug"/>
</target>
However, this works fine when running the Ant build locally.
Some people say to delete the environment variables that the composer installer sets; however it does not seem to change anything.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (13 by maintainers)
It’s better to just set it to
composer.jsonthen.No, what I meant was that it looks like there is an environment variable named
COMPOSERthat is set toC:\ProgramData\ComposerSetup\bin. Because that is the flow your code is executing. Hence why I asked numerous times if you can check your environment variables in the context of that task, cause it definitely looks like theCOMPOSERenvironment variable is set to that specific value.