Fatal error: Class 'Page' not found - installation SS4.2.1 via composer

Silverstripe Version: 4.2.1

On attempt to install: Fatal error: Class ‘Page’ not found… \vendor\silverstripe\errorpage\src\ErrorPage.php on line 37

I tried to install SS 4.2.2, but that came up with errors on the installation (screenshots can be provided), so I deleted all files and downloaded SS4.2 using composer, as I thought that might be a bit more stable.

On first installation attempt I got on the installation screen a few errors. After I set the php version to 7.1.9 (WAMP) the installation went through.
When I created another folder/project and downloaded SS4.2 using composer (it was installing it from cache), I got the message "Fatal error: Class 'Page not found… \vendor\silverstripe\errorpage\src\ErrorPage.php on line 37.
I deleted all files and tried to download version SS4.2.1 so the installation didn’t come from cache, but the message was the same.
In both cases the installation screen didn’t come up. I immediately got the error message.

Has anybody any idea why it seemed to work in the one project, but not in the other?

Thank you very much.

Please post your code for the Page class

Hi Peter,
Thank you for your quick reply. I didn’t change anything, I just downloaded the SS4.2.1 software via composer and opened the browser for installation - as usual.

@Kimk What was your solution to this? Having the same issue.

I can’t tell you. Somehow this resolved itself. I think I did another dev/build, but definitely had to use PHP 7.1.9. It is really weird.
Sorry, I can’t help. I hope you had the same luck as I and did manage to get it working in the meantime!

Anybody else a suggestion?

5 Years later that same eror still exists.

My Page.php is the one from silverstripe-recipes 4.12

Lost 4 hours. Giving up.