#composer install trying to connect to database

15 messages · Page 1 of 1 (latest)

limpid shuttle
#

I've inherited a Laravel project that I'm trying to get up and running. I'm running composer install and it's failing with the following error No connection could be made because the target machine actively refused it (Connection: mysql, SQL: select exists (select 1 from information_schema.tables where table_schema = 'xxxxx' and table_name = 'assets_meta' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED')) asexists) at Script @php artisan statamic:install --ansi handling the post-autoload-dump event returned with error code 1. I don't understand why this is looking for the database at this point? Surely this is the just pulling down the packages, and the next step, running Sail will deploy everything including the db and other dependencies? I can see the @php artisan statamic:install --ansi command in the post-autoload-dump in composer.json - I'm not sure if it shouldn't be there or if something else is going wrong. I'm pretty new to Laravel so I might be misunderstanding something completely.

upper girder
#

Sounds like a wonky app that’s attempting to access the DB in a service provider, which is a bad practice. So perhaps start looking there? Maybe you can disable the provider temporarily or something

limpid shuttle
#

I've tried commenting out everything in bootstrap/providers.php but it made no difference. I couldn't see anything in any of the providers that looked like it was actually trying to connect to a db

winter lichen
#

ah its statamic- this doesnt suprise me as its a CMS (package?) for laravel, sort of like wordpress, so its probably checking the version in DB like wordpress and others do

#

I can gurantee they installed Sail before statamic, hence this problem. I would remove the @php artisan statamic:install --ansi from the post-autoload-dump in composer.json, run composer install, then sail up -d (to start the docker containers) then sail bash to get into the container and finally php artisan statamic:install --ansi to run the command manually inside the container, so it has DB access. I'm not 100% on how to install statmic, but if its using the main DB your app will be, this is what i would do.

limpid shuttle
#

so removing that line did get me past it (and onto more errors!). However one thing I didn't say was that I was trying this on Windows. I've just tried the same thing on Linux (well actuall WSL) and it doesn't get this error at all.

winter lichen
#

The same thing being composer install, with the statamic package in composer.json?

#

I would expect based on the error you got, on a fresh WSL install, you would get the same error as originally as there would be no DB to connect to- unless statamic is upping it's own docker image with a database in it (which i'm unsure of!)

#

might be worth running a docker ps and seeing what docker containers you have running- and if statamic is creating its own container with DB

limpid shuttle
#

definitely no mysql or db running anywhere on windows/wsl/etc. It shouldn't even be trying to get to a db at the composer install stage anyway

winter lichen
#

Very strange that it's not erroring in WSL then! do you have MySQL installed as a package in WSL?

limpid shuttle
#

nope. I'll just use WSL for now

winter lichen
#

Yeah that's fair enough- I always recommend doing dev in WSL when on Windows anyway as it just makes life easier 😄

limpid shuttle
#

I must admit a year or so ago I tried getting this same app running and again had all kinds of problems with Windows and ended up using WSL. The app has moved on and I've had to re-format since then and I thought I'd try getting this running on Windows this time - the Laravel website suggests Windows is supported but my experience is that it really isn't.