machinateur / android-chrome-tab-transfer

A tool to transfer google chrome tabs from your android phone to your computer using `adb`.
MIT License
90 stars 10 forks source link

Class "Symfony\Component\Console\Command\Command" not found #17

Closed HeyItsJono closed 1 year ago

HeyItsJono commented 1 year ago

Hey thank you for this tool, I'm trying to get up and running on Windows. I've downloaded ADB and PHP 8.2, they're in my PATH. I've installed Composer, I've restarted my command prompt. I can call PHP and ADB from the commandline.

However, when I try to run php copy-tabs.php I get the following error:

php copy-tabs.php
PHP Fatal error:  Uncaught Error: Class "Symfony\Component\Console\Command\Command" not found in android-chrome-tab-transfer\src\Command\CopyTabsCommand.php:43
Stack trace:
#0 android-chrome-tab-transfer\vendor\composer\ClassLoader.php(582): include()
#1 android-chrome-tab-transfer\vendor\composer\ClassLoader.php(433): Composer\Autoload\{closure}()
#2 android-chrome-tab-transfer\copy-tabs.php(32): Composer\Autoload\ClassLoader->loadClass()
#3 {main}
  thrown in android-chrome-tab-transfer\src\Command\CopyTabsCommand.php on line 43

I'd appreciate any advice you could offer on fixing it.

HeyItsJono commented 1 year ago

Apologies, both my issues came about because I stupidly misread the README. I was running php copy-tabs.php instead of running copy-tabs.cmd. This skipped the composer install part and so none of the dependencies got installed which obviously caused issues. I then used composer dump-autoload to generate the vendor folder, so even when using copy-tabs.cmd the composer install command got skipped because it running is contingent upon the vendor folder not existing.

So TLDR for anyone with the same issue just read the readme and run the batch file rather than calling the script straight from php. And if you've already generated the autoload file manually, run composer install.

machinateur commented 1 year ago

Hey there,

you're absolutely correct. This issue is caused by the missing composer dependencies. They can be installed using the composer install command. Of course this also requires composer to be installed in the first place.

As I wrote in #16, I will add a more user-friendly error message, when this happens.

Best regards machinateur