Getting error when trying to install sample data:
count(): Argument #1 ($value) must be of type Countable|array, Closure given#0 /var/www/html/vendor/composer/composer/src/Composer/Autoload/AutoloadGenerator.php(1202): count()
This is on a fresh install:
bin/magento deploy:mode:set developer
rm -rf generated/metadata/* generated/code/*
It is at this point I’m getting the error.
Searching on the web it seems it is specifically a php8.1 error.
Can anyone suggest a fix?
Rather than fix this, I eventually avoided the problem all together by installing the sample data Via the GitHub Repository.
My Notes are below for anyone who has the same issue (obviously your paths may differ):
Click on “Latest”
Assets > Source code (zip)
Copy magento2-sample-data-2.4.5-p1.zip TO /var/www/html/
php -f magento2-sample-data-2.4.5-p1/dev/tools/build-sample-data.php -- --ce-source="/var/www/html/"
We will not see any images without pre generating the product image cache
801 images (11 minutes)
php bin/magento catalog:image:resize
Thanks for posting this !
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.