statamic / ssg

The official Statamic Static Site Generator
229 stars 23 forks source link

Netlify: PHP Fatal error: require(): Failed opening required '/opt/build/repo/vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/build/repo/please on line 18 #97

Closed devfaysal closed 2 years ago

devfaysal commented 2 years ago

php please ssg:generate command working fine locally but failing in netlify deploy with the errors below. I was using Statamic 3.0 and it was working fine, but today I upgraded to 3.3 and getting errors.

PHP Warning: require(/opt/build/repo/vendor/autoload.php): failed to open stream: No such file or directory in /opt/build/repo/please on line 18 PHP Fatal error: require(): Failed opening required '/opt/build/repo/vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/build/repo/please on line 18

"statamic/cms": "^3.3", "statamic/ssg": "^1.0",

duncanmcclean commented 2 years ago

You need to run ‘composer install’ on Netlify before you run it.

devfaysal commented 2 years ago

No, Netlify itself Run composer install if it is a PHP project.

I fixed the problem, but it was a weird issue. I deleted everything from the database/factories folder as these were useless when I started using Statamic. 'composer install' command failed because of that. I just went through the full deploy log, then I noticed this.

Screenshot(598)

Now I created a factory and pushed it, the Build is completed successfully.

michaelmannucci commented 1 year ago

Could you please explain more what you did? I’m having the same issue and I’m not sure how to fix it.

ssyberg commented 1 year ago

Also having this issue, would love more details as well!

michaelmannucci commented 1 year ago

The issue I had is my local dev was PHP 8.1 and Netlify I believe can only do 8.0. Looks like I had a different issue from the OP. I fixed it by changing my local dev to PHP 8.0, running composer update locally, and then it deployed fine.