Fatal Error: Meta Box searches for /vendor/autoload.php which is not found
- This topic has 7 replies, 3 voices, and was last updated 2 years, 10 months ago by Anh Tran. 
- 
		AuthorPosts
- 
		
			
				
December 20, 2022 at 6:13 PM #39936dotsunited ParticipantSo I tried to run the composer update command to update meta box and other dependencies. I ran the command an Meta Box was updated from 5.6.8 to 5.6.14. This now causes the following issue: Fatal error: Uncaught Error: Failed opening required '/xxx/meta-box/vendor/autoload.php' 
 Failed to open stream: No such file or directory in /xxx/meta-box/inc/loader.php on line 63So Meta Box is searching for the "autoload.php" in the "/vendor" directory which can't be found because there is no such directory. Is this already a known issue? Support on this would be much appreciated, thanks! December 20, 2022 at 10:28 PM #39944Peter ModeratorHello, Please try to run composer installin the meta box plugin folder to fix this issue. Let me know how it goes.December 20, 2022 at 10:54 PM #39948dotsunited ParticipantHello Peter, thanks for your reply. sadly this did not solve the issue. I'm still getting the fatal error. I'll attach the full error here: Warning: require(/homepages/15/d.../wp-content/mu-plugins/meta-box/vendor/autoload.php): Failed to open stream: No such file or directory in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php on line 63 Fatal error: Uncaught Error: Failed opening required '/homepages/15/d.../wp-content/mu-plugins/meta-box/vendor/autoload.php' (include_path='.:/usr/lib/php8.1') in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php:63 Stack trace: #0 /homepages/15/d.../wp-content/mu-plugins/meta-box/meta-box.php(19): RWMB_Loader->init() #1 /homepages/15/d.../wp-content/mu-plugins/mu-plugin-loader.php(18): require_once('/homepages/15/d...') #2 /homepages/15/d.../wp-includes/class-wp-hook.php(308): DotsUnited\MuPluginLoader\{closure}('') #3 /homepages/15/d.../wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #4 /homepages/15/d.../wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /homepages/15/d.../wp-settings.php(412): do_action('muplugins_loade...') #6 /homepages/15/d.../wp-config.php(116): require_once('/homepages/15/d...') #7 /homepages/15/d.../wp-load.php(50): require_once('/homepages/15/d...') #8 /homepages/15/d.../wp-blog-header.php(13): require_once('/homepages/15/d...') #9 /homepages/15/d.../index.php(17): require('/homepages/15/d...') #10 {main} thrown in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php on line 63December 21, 2022 at 10:56 PM #39963Peter ModeratorHello, Did you go to the folder "/homepages/15/d.../wp-content/mu-plugins/meta-box" and run the command composer install? The filevendor/autoload.phpwill be generated after running the command.If it still does not work, you can download the plugin Meta Box from WordPress.org and replace it with the meta box folder on your hosting. 
 https://wordpress.org/plugins/meta-box/December 22, 2022 at 5:02 PM #39988dotsunited ParticipantHello Peter, in our WordPress projects we are basically using a composer.jsonin the project's root directory to install plugins.A simplified version looks like this: { "config": { "allow-plugins": { "composer/installers": true } }, "repositories": [ { "type": "composer", "url": "https://wpackagist.org" } ], "require": { "composer/installers": "^1.4", "wpmetabox/meta-box": "5.6.14" }, "extra": { "installer-paths": { "public/plugins/{$name}/": [ "type:wordpress-plugin", "type:wordpress-muplugin" ], "public/themes/{$name}/": [ "type:wordpress-theme" ] }, "wordpress-install-dir": "public" } }This results in the wpmetabox/meta-boxpackage being installed to./public/plugins/meta-box. There is no./public/plugins/meta-box/vendorfolder, which seems to match the contents of the repository at https://github.com/wpmetabox/meta-box/tree/5.6.14We would prefer to stick to this workflow using Composer instead of manually updating plugins or switching to the archives found on https://wordpress.org/plugins/meta-box/ Maybe this behavior is caused by the entries in .distignoreor some missing hook for the Composer WordPress installer.December 22, 2022 at 9:57 PM #39995Anh Tran KeymasterHi, I've just fixed it. Can you please try this fix? I'll release new version for Meta Box soon when it's confirmed. December 22, 2022 at 10:43 PM #39999dotsunited ParticipantHello! Thanks for the fix you've provided. I've implemented it and now the error message changed to this: Fatal error: Uncaught Error: Class "MetaBox\Updater\Option" not found in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php:103 Stack trace: #0 /homepages/15/d.../wp-content/mu-plugins/meta-box/meta-box.php(19): RWMB_Loader->init() #1 /homepages/15/d.../wp-content/mu-plugins/mu-plugin-loader.php(18): require_once('/homepages/15/d...') #2 /homepages/15/d.../wp-includes/class-wp-hook.php(308): DotsUnited\MuPluginLoader\{closure}('') #3 /homepages/15/d.../wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #4 /homepages/15/d.../wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /homepages/15/d.../wp-settings.php(412): do_action('muplugins_loade...') #6 /homepages/15/d.../wp-config.php(116): require_once('/homepages/15/d...') #7 /homepages/15/d.../wp-load.php(50): require_once('/homepages/15/d...') #8 /homepages/15/d.../wp-blog-header.php(13): require_once('/homepages/15/d...') #9 /homepages/15/d.../index.php(17): require('/homepages/15/d...') #10 {main} thrown in /homepages/15/d.../wp-content/mu-plugins/meta-box/inc/loader.php on line 103So that did not completely fix the problem. December 22, 2022 at 10:49 PM #40001Anh Tran KeymasterLooks like when you use Composer, after installing packages, you don't include the Composer's autoload.phpfile.There are 2 workarounds for this case: 1. In your code, just add this line somewhere: require 'path/to/vendor/autoload.php';(Note that this is the vendor/autoload.phpgenerated by Composer, it's in the root folder. It's not thevendorfolder in Meta Box).This way, when you install anything with Composer (maybe a common PHP lib), autoload will works for all packages, not just Meta Box. 2. Or replace Meta Box's Composer package wpmetabox/meta-boxwith WP Packagist. Using this method, you'll pull all the content from wordpress.org/plugins/meta-box/ into your code, and thus - will contain fullvendorfolder. And you don't have to modify your code.
- 
		AuthorPosts
- You must be logged in to reply to this topic.