Log1x / navi

A developer-friendly alternative to the WordPress NavWalker.
https://github.com/Log1x/navi
MIT License
311 stars 29 forks source link

Target class [navi] does not exist. Sage 10 release (March 1st, 2022) #52

Closed minemindmedia closed 2 years ago

minemindmedia commented 2 years ago

With the latest release of sage 10 (yesterday), I am attempting to load this and am getting this same error. I copied the example for sage 10 exactly and then found this thread and attempted wp acorn optimize:clear on my local and receive the following error via terminal:

/current$ wp acorn optimize:clear

Error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Not sure what is happening here?

Log1x commented 2 years ago

Error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

do your other wp-cli commands work that interact with the database? this looks to be an environment problem

are you on Acorn 2.0.0 or 2.0.1?

minemindmedia commented 2 years ago

Nope, wp-cli db search returns the same error.

I am running "roots/acorn": "^2.0", via composer.

Log1x commented 2 years ago

You will have to fix your issue with WP-CLI first.

https://github.com/Log1x/navi/issues/51 seemed to of had the same issue (possibly a similar dev environment)?

minemindmedia commented 2 years ago

Hmm, thanks! Not sure here. I use the same dev environments for all my projects (Trellis, Bedrock, Sage) and everything works with previous versions of Sage until this latest v10 release from the 1st of March. I'll keep trying!

akasharkbow commented 2 years ago

At there @minemindmedia, not sure if this helps but the command wp acorn optimize:clear didn't work for me this morning on a brand new install but I found this command wp acorn clear-compiledthat fixed the problem for me.

I found the idea here.

minemindmedia commented 2 years ago

Hi, thanks! Unfortunately, I have still having issues. The original issue was that this latest project defaulted to PHP 8.1 and was resolved by switching to 8.0. Now I can run the wp-cli commands.

I have copied the examples files to my project: Composers/Navigation.php

partials/navigation.blade.php

and have included the file in my sections/header.blade.php file: @include('partials.navigation')

and I receive this error: Illuminate\View\ViewException: Target class [navi] does not exist. (View: /srv/www/sage10test.com/current/web/app/themes/sage10test/resources/views/sections/header.blade.php) (View: /srv/www/sage10test.com/current/web/app/themes/sage10test/resources/views/sections/header.blade.php) (View: /srv/www/sage10test.com/current/web/app/themes/sage10test/resources/views/sections/header.blade.php)

Running the commands as suggested complete successfully:

vagrant@trellis:/srv/www/sage10test.com/current$ wp acorn optimize:clear

Compiled views cleared! Configuration cache cleared! Compiled services and packages files removed! Caches cleared successfully! vagrant@trellis:/srv/www/sage10test.com/current$

vagrant@trellis:/srv/www/sage10test.com/current$ wp acorn clear-compiled

Compiled services and packages files removed! vagrant@trellis:/srv/www/sage10test.com/current$

jdebuchy commented 2 years ago

I'm running under the same issue in a fresh installation (trellis, bedrock and sage 10).

Will investigate so I can share you more insights.

Thanks!!

Log1x commented 2 years ago

I'm experiencing the issue as well with various packages. It seems there is a bug in Acorn when it comes to package discovery, but I'm having trouble replicating it consistently. Sometimes it works, sometimes it doesn't.

jdebuchy commented 2 years ago

Thanks for that quick reply @Log1x . Do you think I can help you in replicating this error?

Log1x commented 2 years ago

Not 100% sure at the moment. It seems some people are having the issue while others are not. I think it's more likely to see the issue with multiple packages installed though. I've raised the issue internally & will try to get an issue raised on the Acorn tracker tonight.

In the mean time, the best you could do is publish the configs for Acorn and add Navi and any other package manually to Providers in config/app.php

jdebuchy commented 2 years ago

Ok, thanks! That worked. Leaving further instructions if anyone else is interested:

  1. Publish config for Acorn

    wp acorn vendor:publish

    Choose Roots\Acorn\Providers\AcornServiceProvider

  2. Include Navi inside providers (config/app.php)

    Log1x\Navi\Providers\NaviServiceProvider::class,
minemindmedia commented 2 years ago

@jdebuchy -- Thank you so much for the manual work around! Works as expected.

jdebuchy commented 2 years ago

@minemindmedia , all the credit goes to @Log1x. I simply put his instructions into a list :).

minemindmedia commented 2 years ago

Of course! Thanks you Brandon @Log1x

Log1x commented 2 years ago

This should hopefully be fixed now with Acorn 2.0.3

MikeiLL commented 2 years ago

Alas, I had same issue (same fix) with Acorn 2.0.3.

prabuvenkat commented 2 years ago

Did not work with 2.0.3 for me too. Using @jdebuchy's workaround.