4

i want to ask, i get this message from git bash when i type this

$ composer require slim/slim "^3.0" then appear warn like this.

[RuntimeException]
  Could not scan for classes inside "app/AppKernel.php" which does not appear
   to be a file nor a folder

Can you help me guys ? sorry for bad english.

Thank you.

jub0bs
  • 60,866
  • 25
  • 183
  • 186
IDontKnow
  • 41
  • 1
  • 3

1 Answers1

1

This answer can help https://stackoverflow.com/a/42934196/2110663

Check your composer.json file for occurencies app/AppKernel.php, and check your file structrue to be sure that you have this file in path.
In my case i had next part in composer.json (see classmap)

 ...
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle",
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
 ...

I tried to build dockerfile and cache at first vendors without code dependency. So My dockerfile looks next

...
ADD composer.json .
ADD composer.lock .
RUN composer install
...

In this case filesystem does not contain app/AppKernel.php file, but composer.json file required for it.
To resolve this issue we have 2 options:

  1. Update composer.json and remove from it mentions of problematic files
  2. Add files, or check its existence in file-system

My solution was to add absent files before running composer install. Updated Dockerfile looks next:

ADD composer.json .
ADD composer.lock .
# Fix composer install issue with adding 2 lines below
ADD app/AppKernel.php app/
ADD app/AppCache.php app/

RUN composer install

Hope this hint might helps for somebody else

Panoptik
  • 1,094
  • 1
  • 16
  • 23