Log1x / acf-composer

Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10.
https://github.com/Log1x/acf-composer
MIT License
423 stars 57 forks source link

Installing produces PHP Fatal Error #102

Closed thomaslanenh closed 2 years ago

thomaslanenh commented 2 years ago

`PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php:1093 Stack trace:

0 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(886): Illuminate\Container\Container->notInstantiable('Illuminate\Cont...')

1 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build('Illuminate\Cont...')

2 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve('Illuminate\Cont...', Array, true)

3 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(694): Illuminate\Foundation\Application->resolve('Illuminate\Cont...', Array)

4 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make('Illuminate\Cont...', Array)

5 /app/wp in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php on line 1093

Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php:1093 Stack trace:

0 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(886): Illuminate\Container\Container->notInstantiable('Illuminate\Cont...')

1 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build('Illuminate\Cont...')

2 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve('Illuminate\Cont...', Array, true)

3 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(694): Illuminate\Foundation\Application->resolve('Illuminate\Cont...', Array)

4 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make('Illuminate\Cont...', Array)

5 /app/wp in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php on line 1093`

Attempted to follow the set up guide but any

wp acorn acf:field Example

commands run produce this error.

Log1x commented 2 years ago

can you try beta.7 of acorn?

thomaslanenh commented 2 years ago

Same error(s) unfortunately :( Unless I updated to the beta revision wrong.

Log1x commented 2 years ago

Can you try clearing the wp-content/cache/acorn directory? (after upgrading to beta.7)

thomaslanenh commented 2 years ago

Hmmm, I don't actually have a wp-content/cache folder. Maybe therein lies the issue?

Log1x commented 2 years ago

yea, sage/acorn beta is all over the place the past month.

how about in themes/sage/storage/framework/cache?

delete packages.php and services.php and then wp acorn optimize and then try doing a field again

thomaslanenh commented 2 years ago

So I tried that and I think it provided a different error now...a critical one rip. Thanks for your help btw.

`PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php:1093 Stack trace:

0 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(886): Illuminate\Container\Container->notInstantiable('Illuminate\Cont...')

1 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build('Illuminate\Cont...')

2 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve('Illuminate\Cont...', Array, true)

3 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(694): Illuminate\Foundation\Application->resolve('Illuminate\Cont...', Array)

4 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make('Illuminate\Cont...', Array)

5 /app/wp in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php on line 1093

Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php:1093 Stack trace:

0 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(886): Illuminate\Container\Container->notInstantiable('Illuminate\Cont...')

1 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build('Illuminate\Cont...')

2 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve('Illuminate\Cont...', Array, true)

3 /app/wp-content/themes/sage/vendor/illuminate/container/Container.php(694): Illuminate\Foundation\Application->resolve('Illuminate\Cont...', Array)

4 /app/wp-content/themes/sage/vendor/roots/acorn/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make('Illuminate\Cont...', Array)

5 /app/wp in /app/wp-content/themes/sage/vendor/illuminate/container/Container.php on line 1093

Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.`

Log1x commented 2 years ago

does wp acorn optimize:clear work or is the CLI broken entirely?

Log1x commented 2 years ago

how old is your project? can you update it to have parity with the latest sage 10? have you customized your sage 10 configs? if so can you delete them all so it has parity with dev-main

thomaslanenh commented 2 years ago

It works. Interestingly, the acf actions now appear when you do wp acorn list, which weren't before. But when you try to use one you get a fatal error.

thomaslanenh commented 2 years ago

From this morning lol. I'll try deleting those and report back in.

thomaslanenh commented 2 years ago

Okay so...I downloaded Sage 10 beta 2 and overwrote my existing files. That seemed to allow wp acorn acf:field Example to work! But it doesn't actually work. It's getitng me to a problem I had with ACF Builder and Sage 9. It doesn't seem to be actually doing anything. Which I presume makes sense now that ACF composer is working i'm back to my ACF Builder bug?

Thanks

Log1x commented 2 years ago

thats really strange it wouldn't be working.. are you on the latest ACF Pro? all of the stubs generated should work out of the box (e.g. add a field to Post, or create an example Block)

thomaslanenh commented 2 years ago

Yep. It does it both for Sage 9 and Sage 10, using Trellis / Bedrock & not using them, which makes me think maybe i missed something. It seems like setup.php just doesn't get run or something? Or does regular ACF need to be installed in addition to Pro?

Log1x commented 2 years ago

nope just pro and make sure its activated of course. you don't have to do anything special. 😕

Log1x commented 2 years ago

can you try an options page? or a block? nothing works?

thomaslanenh commented 2 years ago

That's the odd thing; it gets created but nothing gets reflected on the actual site. :(

So:

`www-data@3f8e438a1783:/app$ wp acorn acf:block TestBlock

🎉 TestBlock block successfully composed. ⮑ app/Blocks/TestBlock.php ⮑ resources/views/blocks/test-block.blade.php`

 app/blocks/TestBlock.php produces:
 `<?php

namespace App\Blocks;

use Log1x\AcfComposer\Block; use StoutLogic\AcfBuilder\FieldsBuilder;

class TestBlock extends Block { /**

and views.../TestBlock.php produces: `

@if ($items)

    @foreach ($items as $item)
  • {{ $item['item'] }}
  • @endforeach

@else

{{ $block->preview ? 'Add an item...' : 'No items found!' }}

@endif

`

But nothing appears on the site. It's very odd. ACF Builder I was having the same issue with both Sage 9 and Sage 10 in that it wouldn't actually do anything after setting it up. If I try to reinstall ACF Builder now though I get:

`composer require stoutlogic/acf-builder --with-all-dependencies Using version ^1.12 for stoutlogic/acf-builder ./composer.json has been updated Running composer update stoutlogic/acf-builder --with-all-dependencies Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1

You can also try re-running composer require with an explicit version constraint, e.g. "composer require stoutlogic/acf-builder:*" to figure out if any version is installable, or "composer require stoutlogic/acf-builder:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content. `

Log1x commented 2 years ago

does anything related to ACF work in your environment? can you use get_field('test') or does it throw the function not existing? is it showing up in the backend? the above error is just composer being dumb. try running composer upgrade first - but regardless, you don't need to bring in acf-builder. acf-composer already does.

thomaslanenh commented 2 years ago

So, interesting, that block i created worked! So it just seems anything involving the FieldBuilder that isn't a Block related doens't for some odd reason? Like I can even see the Item repeater in the test block but not in the field, unless i'm being a idiot and not looking in the right area (which is totally possible lol)

thomaslanenh commented 2 years ago

edit: I got it back, somehow acf composer got uninstalled; above error still applies

Log1x commented 2 years ago

on a fresh Bedrock & Sage 10 install I get my test field at the bottom of the block editor:

Screenshot

Log1x commented 2 years ago

Does the field show up in Gutenberg Preferences (Top right Gear -> Preferences)?

Screenshot

thomaslanenh commented 2 years ago

Woah, it just randomly started working after it uninstalled itself and I reinstalled it. I don't know what caused that to make it kick in and work but thank you for all the help. If there's anything I can send you to help asisst if this is a repeatable issue.

Log1x commented 2 years ago

glad you got it working! sounds like some dependency hell or something weird with caching. Acorn might've played a part in this (at least on Sage 10) but will be fixed in beta 8 or 9 in entirety.