ramsey / php-library-starter-kit

:building_construction: A tool to quickly set up the base files of a PHP library project.
MIT License
244 stars 25 forks source link

Error when instalation #32

Closed kristt26 closed 2 years ago

kristt26 commented 3 years ago

image

ramsey commented 3 years ago

Does this happen every time you try to run the create-project command, or is it intermittent?

simpleapps-io commented 3 years ago

I just ran into this issue as well. library error

simpleapps-io commented 3 years ago

Update: the -b option was added to git in version 2.28. I am currently using version 2.20.1. I am going to try updating my version of git to see if this resolves the issue.

simpleapps-io commented 3 years ago

After upgrading to git version 2.32.0 in my docker container I was able to get through the install. I hope this helps.

ramsey commented 3 years ago

Thanks! I didn't realize -b was such a new addition to git init. I'll see if there's a way to work around this.

ramsey commented 3 years ago

I've made some changes that should help with this issue:

@simpleapps-io, this package now supports versions of Git that do not have the -b option for git init

@kristt26, I do not believe your issue is the same as the one @simpleapps-io reported because your error occurs after the "Updating the CHANGELOG.md" heading. In both cases, the error message was the same because of an error in catching and logging the exception (the "Array to string conversion" exception was thrown while trying to process an earlier exception). So, I've made changes that should help provide a better error message. Please try to create a new project and let me know what error you get (if any) this time.

Thanks!

simpleapps-io commented 3 years ago

Using git 2.20. I now get this new error :-) git-lib-error

ramsey commented 3 years ago

@simpleapps-io I'm trying to use a Docker image with Git 2.20, but the version of Debian is so old that I'm having trouble getting a newer version of PHP on it. 😄

Can you run the same create-project command again with -vvv after it and paste the error message here? It'll give a full stack trace string following the message in your screenshot.

Thanks!

simpleapps-io commented 3 years ago

I've been using the Bitnami images as my base https://github.com/bitnami/bitnami-docker-php-fpm

error1 error2

ramsey commented 3 years ago

Thanks for the info, @simpleapps-io!

I've made a new release, 3.1.0. Please give that a try and let me know if you run into anymore problems. I'm hoping they're all resolved now. 😁 🤞🏻

simpleapps-io commented 3 years ago

Works with git 2.20.0 with PHP 8.0.9

ramsey commented 3 years ago

That's great to hear!

@kristt26, please let me know if you continue to have problems with installation.

kristt26 commented 3 years ago

Does this happen every time you try to run the create-project command, or is it intermittent?

Yes, right

kristt26 commented 3 years ago

That's great to hear!

@kristt26, please let me know if you continue to have problems with installation.

i am using php 8

ramsey commented 3 years ago

because there was a problem during the installation I ended up not using it

Sorry about that. Can you try running it again, though? It should output a better error message this time, which will help me debug the problem.

Thanks!

kristt26 commented 3 years ago

error

still having error while installing

ramsey commented 3 years ago

Please run the command with -vvv and copy and paste the output here. I'm not able to scroll back up your screenshot, so it makes it hard for me to understand what's going on.

Thanks!

kristt26 commented 3 years ago
 post-create-project-cmd: Ramsey\Dev\LibraryStarterKit\Wizard::start
Script Ramsey\Dev\LibraryStarterKit\Wizard::start handling the post-create-project-cmd event terminated with an exception
Reading ./composer.json (C:\xampp\htdocs\testinglibs\composer.json)
Loading config file ./composer.json (C:\xampp\htdocs\testinglibs\composer.json)
Failed to initialize global composer: Composer could not find the config file: C:/Users/krist/AppData/Roaming/Composer/composer.json

Reading C:\xampp\htdocs\testinglibs/vendor/composer/installed.json (C:\xampp\htdocs\testinglibs\vendor\composer\installed.json)

  [ErrorException]
  Array to string conversion

Exception trace:
 () at phar://C:/composer/composer.phar/vendor/symfony/process/Process.php:263
 Composer\Util\ErrorHandler::handle() at phar://C:/composer/composer.phar/vendor/symfony/process/Process.php:263
 Symfony\Component\Process\Process->start() at phar://C:/composer/composer.phar/vendor/symfony/process/Process.php:196
 Symfony\Component\Process\Process->run() at C:\xampp\htdocs\testinglibs\src\LibraryStarterKit\Wizard.php:129
 Ramsey\Dev\LibraryStarterKit\Wizard->getGitUserName() at C:\xampp\htdocs\testinglibs\src\LibraryStarterKit\Wizard.php:76
 Ramsey\Dev\LibraryStarterKit\Wizard->__construct() at C:\xampp\htdocs\testinglibs\src\LibraryStarterKit\Wizard.php:253
 Ramsey\Dev\LibraryStarterKit\Wizard::start() at phar://C:/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:377
 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar://C:/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:236
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar://C:/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:117
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar://C:/composer/composer.phar/src/Composer/Command/CreateProjectCommand.php:292
 Composer\Command\CreateProjectCommand->installProject() at phar://C:/composer/composer.phar/src/Composer/Command/CreateProjectCommand.php:158
 Composer\Command\CreateProjectCommand->execute() at phar://C:/composer/composer.phar/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar://C:/composer/composer.phar/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/composer/composer.phar/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar://C:/composer/composer.phar/src/Composer/Console/Application.php:317
 Composer\Console\Application->doRun() at phar://C:/composer/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar://C:/composer/composer.phar/src/Composer/Console/Application.php:125
 Composer\Console\Application->run() at phar://C:/composer/composer.phar/bin/composer:67
 require() at C:\composer\composer.phar:24
goodevilgenius commented 3 years ago

I have this same issue.

Screen Shot 2021-09-09 at 10 25 04 AM

This is on macOS with php 8.0.10, installed through homebrew.

I'll try this out on my Linux box later and see if I get the same thing.

goodevilgenius commented 3 years ago

image

Yep. Same error on Linux with the same version of PHP (8.0.10).

ramsey commented 2 years ago

Without seeing the full log output (all the way from the line where you executed the create-project command), it's difficult to tell what's going on in these cases.

However, I've made some guesses at the problem, and I think this is fixed in the latest release, so please give it another try.

I think the problem is related to errors that occur during the test run at the very end of the program. I think it encounters PHP CodeSniffer errors, and this causes it to exit with this message. The CodeSniffer errors I've seen are usually related to use statements being out of alphabetical order, depending on the namespace name chosen. In the latest release, the program now attempts to fix any fixable coding standards issues before running the tests, to avoid this problem.

goodevilgenius commented 2 years ago

Worked for me this time on the same computer as before.

kocbek commented 2 years ago
> Ramsey\Dev\LibraryStarterKit\Wizard::start
Script Ramsey\Dev\LibraryStarterKit\Wizard::start handling the post-create-project-cmd event terminated with an exception

  [ErrorException]
  Array to string conversion

I'm experiencing this issue with PHP 8.0.13 (cli) (built: Nov 16 2021 21:58:37) ( ZTS Visual C++ 2019 x64 ) on Win10.

It looks like code is not fixed in the latest release.

I've added the -vvv log composer_log.txt