pressbooks / local-dev-environment

This repository uses Lando/Docker to provision a local instance of Pressbooks for testing and development by open source contributors.
2 stars 1 forks source link

[Bug] - Fatal error: Uncaught Error: Class "Illuminate\Database\Capsule\Manager" not found #7

Closed richard015ar closed 1 month ago

richard015ar commented 5 months ago

From one Open Source user:

Hi Steel!

Hope you're well. It was quite a bumpy start, but meanwhile I am working on the H5P rendering which BCCampus would like to see in Pressbooks. I have created a package and hooked it up to some minimal web frontend for demonstration purposes (https://snordian.de/bccampus-poc/)

I'd now want to use this package in Pressbooks, but I cannot get my local copy running despite having run just fine before. Unfortunately, since I myself don't have a paid Slack account, I lost access to your Slack channel after 90 days and now can't ask you there. Hopefully, this is a small issue that you could help me via email as well.

I am running the latest version of lando and pulled the latest version of the pressbooks repository.

When I now fire up 'lando start', then the tests that it runs fail. The local server that is set up seems to have an issue. The tests fails with a 500 HTTP error, and when I open the local start page to check, I am greeted with

Fatal error: Uncaught Error: Class "Illuminate\Database\Capsule\Manager" not found in /app/web/app/plugins/pressbooks/inc/class-serviceprovider.php:88 Stack trace: #0 /app/web/app/plugins/pressbooks/hooks.php(35): Pressbooks\ServiceProvider::init() #1 /app/web/app/plugins/pressbooks/pressbooks.php(114): require('/app/web/app/pl...') #2 /app/web/wp/wp-settings.php(462): include_once('/app/web/app/pl...') #3 /app/web/wp-config.php(9): require_once('/app/web/wp/wp-...') #4 /app/web/wp/wp-load.php(55): require_once('/app/web/wp-con...') #5 /app/web/wp/wp-blog-header.php(13): require_once('/app/web/wp/wp-...') #6 /app/web/index.php(5): require('/app/web/wp/wp-...') #7 {main} thrown in /app/web/app/plugins/pressbooks/inc/class-serviceprovider.php on line 88

Trying lando composer update or lando composer install yields

Fatal error: Uncaught Error: Class "Seld\Signal\SignalHandler" not found in /app/vendor/composer/composer/src/Composer/Console/Application.php:109 Stack trace:

0 /app/vendor/composer/composer/bin/composer(93): Composer\Console\Application->__construct()

1 /app/vendor/bin/composer(119): include('/app/vendor/com...')

2 {main}

thrown in /app/vendor/composer/composer/src/Composer/Console/Application.php on line 109

To me as a PHP tool chain novice, this looks like something is missing that should be installed, but I cannot pinpoint this.

If you have any idea, please let me know. Otherwise I'll just give a clean install another shot.

Best, Oliver

richard015ar commented 5 months ago

I was able to install it and make it work, but I could not replicate that experience. I submitted a PR: #8

cmurtagh commented 5 months ago

Hey team! Please add your planning poker estimate with Zenhub @arzola @fdalcin @ho-man-chan @richard015ar @tw77

otacke commented 1 month ago

Since this is still open, I'd like to add a full "retry log":

I set up a virtual machine with a naked Ubuntu 22.04 LTS Desktop. Not 24.04, because that's not yet supported by the VM manager. Installed all missing system updates, then following https://github.com/pressbooks/local-dev-environment.

sudo apt install git

# Set up a new ssh key and registered it with my github account

# curl is not installed by default!?
sudo apt install curl

# Install lando (lando v3.21.2-slim in my case
/bin/bash -c "$(curl -fsSL https://get.lando.dev/setup-lando.sh)"

git clone [git@github.com](mailto:git@github.com):pressbooks/local-dev-environment.git

# Changing to the directory is not listed in your docs
cd local-dev-environment/

cp .env.example .env && cp config_services/.env.example config_services/.env

# Filled in amd64 in config_services/.env

# Filled in salts from https://roots.io/salts.html into .env

lando start

lando db-import pb_local_db.sql

lando install-tests

lando start

That's where the trouble starts. Opening https://pressbooks.test fails. It seems that some PHP dependencies are missing.

ubushot0-lando_start

I ran

rm composer.lock

to ensure not fetching the latest goodies. Had to get a token from github.

Then I ran

lando composer install

To run composer install inside the container. It resulted in a crash of Lando, seemingly when upgrading pressbooks/bedrock:

In FilesystemRepository.php line 163:

file_get_contents(/app/vendor/composer/composer/src/Composer/Repository/../InstalledVersions.php): Failed to open stream: No such file or directory

ubushot1-lando_composer_install

I tried again nevertheless:

lando start

Still opening pressbooks.test fails. Getting the same error message that I had already reported:

Fatal error: Uncaught Error: Class "Illuminate\Database\Capsule\Manager" not found in /app/web/app/plugins/pressbooks/inc/class-serviceprovider.php:88 Stack trace: #0 /app/web/app/plugins/pressbooks/hooks.php(35): Pressbooks\ServiceProvider::init() https://github.com/pressbooks/local-dev-environment/issues/1 /app/web/app/plugins/pressbooks/pressbooks.php(114): require('/app/web/app/pl...') https://github.com/pressbooks/local-dev-environment/pull/2 /app/web/wp/wp-settings.php(462): include_once('/app/web/app/pl...') https://github.com/pressbooks/local-dev-environment/issues/3 /app/web/wp-config.php(9): require_once('/app/web/wp/wp-...') https://github.com/pressbooks/local-dev-environment/pull/4 /app/web/wp/wp-load.php(55): require_once('/app/web/wp-con...') https://github.com/pressbooks/local-dev-environment/pull/5 /app/web/wp/wp-blog-header.php(13): require_once('/app/web/wp/wp-...') https://github.com/pressbooks/local-dev-environment/pull/6 /app/web/index.php(5): require('/app/web/wp/wp-...') https://github.com/pressbooks/local-dev-environment/issues/7 {main} thrown in /app/web/app/plugins/pressbooks/inc/class-serviceprovider.php on line 88

ubushot2-lando_start_again

Hope that helps.

Is there some recommended Linux distribution to run this on that I could try next?

fdalcin commented 1 month ago

Could you try deleting the vendor folder, removing composer.lock and then running lando composer update -W. We haven’t had the time to look into this yet, but I suspect the command might be pulling outdated plugin versions. I had this issue once and the update command did the trick for me.

otacke commented 1 month ago

Heureka!

ubushot3-lando_start_again_again

Thanks a lot!

cmurtagh commented 1 month ago

Awesome, thank you @fdalcin. I'll close this issue. @otacke Please feel free to open another if you encounter other problems.