Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find composer.json #225

Closed
YoSoyElCapitan opened this issue Mar 29, 2022 · 4 comments · Fixed by #233
Closed

Cannot find composer.json #225

YoSoyElCapitan opened this issue Mar 29, 2022 · 4 comments · Fixed by #233
Labels
bug Something isn't working

Comments

@YoSoyElCapitan
Copy link

Description

We are using this in github workflows with mono repo. Composer install can not find composer.json in sub-directories. Cache is empty.

Steps to reproduce

- uses: ramsey/composer-install@2.1.0
     with:
        working-directory: something
        composer-options: --prefer-dist

Expected behavior

Should find composer.json and also create cache.

Screenshots or output

[RuntimeException]
File "./composer.json" cannot be found in the current directory

Environment details

  • mono repo
  • version of this package: 2.1.0
  • PHP version: 8.1

Additional context

Custom cache keys does not solve this problem.

@YoSoyElCapitan YoSoyElCapitan added the bug Something isn't working label Mar 29, 2022
@marcosfreitas
Copy link

marcosfreitas commented Jun 16, 2022

I'm facing something like this, but my composer.json is on the root of the project:

name: Laravel E2E Tests

on:
  push:
    # Publish `main` as Docker `latest` image.
    branches: [main]

    # Publish `v1.2.3` tags as releases.
    tags:
      - v*
  pull_request:
    branches: [main]
    tags:
      - v*

  # manually run a workflow
  workflow_dispatch:

jobs:
  laravel-tests:

    strategy:
      matrix:
        os: [ubuntu-latest]
        php: [7.4]
        dependencies: [lowest, highest]
    runs-on: ${{ matrix.os }}

    steps:
      - uses: actions/checkout@v3

      - uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          extensions: mysqli, pdo_mysql, bcmath, gd

      - uses: "ramsey/composer-install@v2"
        with:
          working-directory: ".." 🐛 
          dependency-versions: "${{ matrix.dependencies }}"

...

image

@marcosfreitas
Copy link

marcosfreitas commented Jun 16, 2022

✅ fixed for me. That was something wrong with the use of the attribute "working-directory". I think it could not be inside quotation marks.

@Spl4shh
Copy link

Spl4shh commented Aug 14, 2022

Hi, I have the same error but with no modification on the working director because it's the repo himself

@tn3rb
Copy link

tn3rb commented Sep 29, 2022

Also getting this issue with a monorepo

path to composer.json in repo: tests/phpunit/composer.json

workflow:

        - name: Composer install
          uses: 'ramsey/composer-install@v2'
          with:
              composer-options: ${{ inputs.composer-options }}  --ansi
              custom-cache-key: ${{ inputs.cache-key }}-${{ steps.timestamp.outputs.hour }}
              dependency-versions: ${{ inputs.composer-dependencies }}
              working-directory: ${{ inputs.composer-path }}

output:

Run ramsey/composer-install@v2
  with:
    composer-options: --optimize-autoloader --ignore-platform-reqs  --ansi
    custom-cache-key: Linux-***-lint-2022-09-29-19
    dependency-versions: locked
    working-directory: tests/phpunit
  env:
    COMPOSER_PROCESS_TIMEOUT: 0
    COMPOSER_NO_INTERACTION: 1
Run ${GITHUB_ACTION_PATH}/bin/php_version.sh
Run ${GITHUB_ACTION_PATH}/bin/should_cache.sh ""
Run ${GITHUB_ACTION_PATH}/bin/composer_paths.sh \
  ${GITHUB_ACTION_PATH}/bin/composer_paths.sh \
    "" \
    "tests/phpunit" \
    "/usr/bin/php"
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    COMPOSER_PROCESS_TIMEOUT: 0
    COMPOSER_NO_INTERACTION: 1

In ConfigCommand.php line 202:
                                                                   
  File "./composer.json" cannot be found in the current directory  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants