Controller class not found

Hi, I installed UserFrosting a few days ago and tried to create a new page, but it didn’t work because UserFrosting did not find the controller class. Then, I tried to follow the documentation, creating the “Site” sprinkle and the “members” page and gave the same error:

RuntimeException
Callable UserFrosting\Sprinkle\Site\Controller\PageController does not exist

I checked the various steps several times, to exclude permission problems I put 777 to all the files and directories, everything seems correct, but I still have the same error.

Composers and routes seem to be correct:

./routes/routes.php
$app->get('/members', 'UserFrosting\Sprinkle\Site\Controller\PageController:pageMembers');

./composer.json
    "description": "Site sprinkle for owlfancy.com.",
            "UserFrosting\\Sprinkle\\Site\\": "src/"

./vendor/composer/autoload_psr4.php
    'UserFrosting\\Sprinkle\\Site\\' => array($baseDir . '/src'),

I Googled for a solution but I haven’t found anything. What else do I have to check?
I have Amazon AWS Linux and Nginx.

Have you double-checked to make sure that you’re following all of the naming conventions for classes, namespaces, and file names? See UserFrosting Documentation | Common Problems

File permissions usually aren’t the problem here, and I would strongly recommend against blindly setting 777 permissions on everything. I honestly hate numeric permissions shortcodes, because they make it seem like some sort of magic, and hide what is actually going on from people who are still learning. Read here to learn more about how Unix permissions actually work :smile:

Sorry for the numeric permissions shortcodes, I meant to say that I had given the permission rwx for user, group and others to all the files and directories. That setting is only temporary to be sure that there are no permission issues. I made a backup and then restore it once I understood the problem.

There are no problems with the naming convention because I have copied and pasted the examples in UserFrosting documentation, more precisely in the section “Your First UserFrosting Site” and “Creating a new page”. Checked the correctness several times.

Could it be a problem with how Nginx passes environment variables to UserFrosting? I have adapted the configuration indicated in the documentation (webserver-configs/nginx.conf).

Oh, awesome! Glad that you have done your due diligence :slight_smile:

Looking at this:

./vendor/composer/autoload_psr4.php
    'UserFrosting\\Sprinkle\\Site\\' => array($baseDir . '/src'),

Something is definitely wrong with how Composer is mapping the path. You’ll notice the other mappings give a path relative to the project root directory:

'UserFrosting\\Sprinkle\\Account\\' => array($baseDir . '/app/sprinkles/account/src'),

Are you running composer update from the root project directory (not the Sprinkle directory)?

You’re right! The problem was that the composer update was made in the sprinkle directory and not in the root directory. An unforgivable error! :frowning_face: Thank you very much!

Haha, I’ve seen half a dozen much more unforgiveable errors in open source today alone. Maybe our docs need to emphasize this a bit more!

I have this exact same problem. Does ‘root project directory’ mean the ‘/site’ directory in the example?

It would be the directory you cloned UF into…the one that has CHANGELOG.md and STYLE-GUIDE.md.

Shazam! That fixed it! I can now see my first page in UF, using homestead!!! Now on to the next snag!!!

:allthethings: