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

Error: file_put_contents(/m2/app/etc/vendor_path.php): Failed to open stream: No such file or directory #115

Open
mcspronko opened this issue May 7, 2024 · 9 comments

Comments

@mcspronko
Copy link

The ExtDN M2 PHPStan workflow returns the below error:

Error: file_put_contents(/m2/app/etc/vendor_path.php): Failed to open stream: No such file or directory
Use the `composer fund` command to find out more!

In PluginManager.php(278) : eval()'d code line 323:
                                                                               
  file_put_contents(/m2/app/etc/vendor_path.php): Failed to open stream: No s  
  uch file or directory                                                        

Configuration used:

name: ExtDN M2 PHPStan
on:
    push:
        branches:
            - main
    pull_request:

jobs:
    phpstan:
        name: M2 PHPStan
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v4
            - uses: extdn/github-actions-m2/magento-phpstan/8.1@master
              with:
                  composer_name: pronko/workflow-tests-magento-module

Am I missing something in the yaml file or there is an issue with the workflow?

@sprankhub
Copy link
Collaborator

@mcspronko
Copy link
Author

Thanks @sprankhub I will try and let you know.

@mcspronko
Copy link
Author

Hi @sprankhub thank you for the suggestion, works like a charm!

@sprankhub
Copy link
Collaborator

Okay, interesting :D So internally, this uses https://github.com/customgento/m2-github-actions/blob/main/.github/workflows/phpstan.yml. The only real difference I see is that it uses PHP 8.2 insteaf of PHP 8.1... 🤔

@mcspronko
Copy link
Author

Interestingly, it worked fine with the https://github.com/customgento/m2-github-actions/blob/main/.github/workflows/phpstan.yml configuration, but when I tried to add a composer_name it fails with the same error:

name: ExtDN M2 PHPStan
on: [push, pull_request]

jobs:
    phpstan:
        name: M2 PHPStan
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v4
            - uses: extdn/github-actions-m2/magento-phpstan/8.2@master
              with:
                  composer_name: pronko/workflow-tests-magento-module
Error: file_put_contents(/m2/app/etc/vendor_path.php): Failed to open stream: No such file or directory
Use the `composer fund` command to find out more!

In PluginManager.php(278) : eval()'d code line 323:
                                                                               
  file_put_contents(/m2/app/etc/vendor_path.php): Failed to open stream: No s  
  uch file or directory                                                        

@sprankhub
Copy link
Collaborator

Then this sounds like a bug to me 🙈

jissereitsma added a commit to yireo/Yireo_GoogleTagManager2 that referenced this issue Jun 28, 2024
jissereitsma added a commit that referenced this issue Jun 28, 2024
@jissereitsma
Copy link
Contributor

I bumped into this issue myself as well. This is what I found: In the PHPStan Docker image, the Integration Testing Docker image is included. Next, specifically for the PHPStan Docker image, composer is used to install Magento https://github.com/extdn/github-actions-m2/blob/master/magento-phpstan/Dockerfile%3A8.3#L4 This should also include all of the magento2-base files that are copied from vendor/ to the application root, including the file app/etc/vendor_path.php (which is mentioned in this issue). For some reason, the end-result of the Docker image however is a filled vendor/ folder, but no additional files.

I've added a quick workaround https://github.com/extdn/github-actions-m2/blob/master/magento-phpstan/entrypoint.sh#L20 to remove the vendor/ folder and re-add it again. After this, everything works just fine for me.

Does this fix things for you as well?

@sprankhub
Copy link
Collaborator

@sprankhub
Copy link
Collaborator

Thanks for looking into this! Do you have any idea for a nicer fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants