statamic / ssg

The official Statamic Static Site Generator
233 stars 24 forks source link

PHP Fatal error: Uncaught Error: Failed opening required '/opt/build/repo/vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/build/repo/please:18 #105

Closed michaelmannucci closed 2 years ago

michaelmannucci commented 2 years ago

I get this error when trying to deploy to Netlify. I am able to build locally fine.

PHP Fatal error: Uncaught Error: Failed opening required '/opt/build/repo/vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/build/repo/please:18

I read on a similar post that you need to run composer install on Netlify, but Netlify runs this command automatically and you can't customize the arguments.

Any ideas?

Here is the whole deploy log:

1:37:54 PM: Build ready to start
1:37:56 PM: build-image version: 0e2f4c52031ab562db66aec633308326e3b108d0 (focal)
1:37:56 PM: build-image tag: focal
1:37:56 PM: buildbot version: ed990b4b6588208e959ba45b6b7b05738f8b6004
1:37:56 PM: Fetching cached dependencies
1:37:56 PM: Failed to fetch cache, continuing with build
1:37:56 PM: Starting to prepare the repo for build
1:37:56 PM: No cached dependencies found. Cloning fresh repo
1:37:56 PM: git clone https://github.com/michaelmannucci/mannucci
1:37:57 PM: Preparing Git Reference refs/heads/main
1:37:58 PM: Parsing package.json dependencies
1:37:59 PM: Starting build script
1:37:59 PM: Installing dependencies
1:37:59 PM: Python version set to 2.7
1:37:59 PM: Downloading and installing node v16.16.0...
1:38:00 PM: Downloading https://nodejs.org/dist/v16.16.0/node-v16.16.0-linux-x64.tar.xz...
1:38:00 PM: Computing checksum with sha256sum
1:38:00 PM: Checksums matched!
1:38:03 PM: Now using node v16.16.0 (npm v8.11.0)
1:38:03 PM: Started restoring cached build plugins
1:38:03 PM: Finished restoring cached build plugins
1:38:03 PM: Attempting ruby version 2.7.2, read from environment
1:38:04 PM: Using ruby version 2.7.2
1:38:05 PM: Using PHP version 8.0
1:38:05 PM: No npm workspaces detected
1:38:05 PM: Started restoring cached node modules
1:38:05 PM: Finished restoring cached node modules
1:38:05 PM: Installing NPM modules using NPM version 8.11.0
1:38:06 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:38:06 PM: npm WARN config location in the cache, and they are managed by
1:38:06 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:38:06 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:38:06 PM: npm WARN config location in the cache, and they are managed by
1:38:06 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:38:12 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
1:38:13 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
1:38:19 PM: added 765 packages, and audited 766 packages in 13s
1:38:19 PM: 78 packages are looking for funding
1:38:19 PM:   run `npm fund` for details
1:38:19 PM: found 0 vulnerabilities
1:38:19 PM: NPM modules installed
1:38:20 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:38:20 PM: npm WARN config location in the cache, and they are managed by
1:38:20 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:38:20 PM: Started restoring cached composer dependencies
1:38:20 PM: Finished restoring cached composer dependencies
1:38:20 PM: Installing dependencies from lock file (including require-dev)
1:38:20 PM: Verifying lock file contents can be installed on current platform.
1:38:20 PM: Your lock file does not contain a compatible set of packages. Please run composer update.
1:38:20 PM:   Problem 1
1:38:20 PM:     - symfony/console is locked to version v6.1.1 and an update of this package was not requested.
1:38:20 PM:     - symfony/console v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 2
1:38:20 PM:     - symfony/css-selector is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/css-selector v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 3
1:38:20 PM:     - symfony/deprecation-contracts is locked to version v3.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/deprecation-contracts v3.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 4
1:38:20 PM:     - symfony/error-handler is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/error-handler v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 5
1:38:20 PM:     - symfony/event-dispatcher is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/event-dispatcher v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 6
1:38:20 PM:     - symfony/event-dispatcher-contracts is locked to version v3.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/event-dispatcher-contracts v3.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 7
1:38:20 PM:     - symfony/filesystem is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/filesystem v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 8
1:38:20 PM:     - symfony/finder is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/finder v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 9
1:38:20 PM:     - symfony/http-foundation is locked to version v6.1.1 and an update of this package was not requested.
1:38:20 PM:     - symfony/http-foundation v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 10
1:38:20 PM:     - symfony/http-kernel is locked to version v6.1.1 and an update of this package was not requested.
1:38:20 PM:     - symfony/http-kernel v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 11
1:38:20 PM:     - symfony/mailer is locked to version v6.1.1 and an update of this package was not requested.
1:38:20 PM:     - symfony/mailer v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 12
1:38:20 PM:     - symfony/mime is locked to version v6.1.1 and an update of this package was not requested.
1:38:20 PM:     - symfony/mime v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 13
1:38:20 PM:     - symfony/process is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/process v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 14
1:38:20 PM:     - symfony/routing is locked to version v6.1.1 and an update of this package was not requested.
1:38:20 PM:     - symfony/routing v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 15
1:38:20 PM:     - symfony/service-contracts is locked to version v3.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/service-contracts v3.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 16
1:38:20 PM:     - symfony/string is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/string v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 17
1:38:20 PM:     - symfony/translation is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/translation v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 18
1:38:20 PM:     - symfony/translation-contracts is locked to version v3.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/translation-contracts v3.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 19
1:38:20 PM:     - symfony/var-dumper is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/var-dumper v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 20
1:38:20 PM:     - symfony/yaml is locked to version v6.1.0 and an update of this package was not requested.
1:38:20 PM:     - symfony/yaml v6.1.0 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:   Problem 21
1:38:20 PM:     - symfony/http-foundation v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.
1:38:20 PM:     - spatie/flare-client-php 1.2.0 requires symfony/http-foundation ^5.0|^6.0 -> satisfiable by symfony/http-foundation[v6.1.1].
1:38:20 PM:     - spatie/flare-client-php is locked to version 1.2.0 and an update of this package was not requested.
1:38:20 PM: Started restoring cached go cache
1:38:20 PM: Finished restoring cached go cache
1:38:20 PM: Installing Go version 1.17 (requested 1.17)
1:38:25 PM: unset GOOS;
1:38:25 PM: unset GOARCH;
1:38:25 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
1:38:25 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
1:38:25 PM: go version >&2;
1:38:25 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
1:38:25 PM: go version go1.17 linux/amd64
1:38:25 PM: Installing missing commands
1:38:25 PM: Verify run directory
1:38:27 PM: ​
1:38:27 PM: ────────────────────────────────────────────────────────────────
1:38:27 PM:   Netlify Build                                                 
1:38:27 PM: ────────────────────────────────────────────────────────────────
1:38:27 PM: ​
1:38:27 PM: ❯ Version
1:38:27 PM:   @netlify/build 27.3.3
1:38:27 PM: ​
1:38:27 PM: ❯ Flags
1:38:27 PM:   baseRelDir: true
1:38:27 PM:   buildId: 62c86b720e13405056a4c481
1:38:27 PM:   deployId: 62c86b720e13405056a4c483
1:38:27 PM: ​
1:38:27 PM: ❯ Current directory
1:38:27 PM:   /opt/build/repo
1:38:27 PM: ​
1:38:27 PM: ❯ Config file
1:38:27 PM:   No config file was defined: using default values.
1:38:27 PM: ​
1:38:27 PM: ❯ Context
1:38:27 PM:   production
1:38:27 PM: ​
1:38:27 PM: ────────────────────────────────────────────────────────────────
1:38:27 PM:   1. Build command from Netlify app                             
1:38:27 PM: ────────────────────────────────────────────────────────────────
1:38:27 PM: ​
1:38:27 PM: $ npm run production && php please ssg:generate && php artisan config:cache
1:38:27 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:38:27 PM: npm WARN config location in the cache, and they are managed by
1:38:27 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:38:27 PM: > production
1:38:27 PM: > mix --production
1:38:29 PM: [info] [webpackbar] Compiling Mix
1:38:34 PM: 
1:38:34 PM:                          
1:38:34 PM:    Laravel Mix v6.0.49   
1:38:34 PM:                          
1:38:34 PM: ✔ Compiled Successfully in 5088ms
1:38:34 PM: ┌───────────────────────────────────┬──────────┐
1:38:34 PM: │                              File │ Size     │
1:38:34 PM: ├───────────────────────────────────┼──────────┤
1:38:34 PM: │                       /js/site.js │ 275 KiB  │
1:38:34 PM: │                  css/tailwind.css │ 17.9 KiB │
1:38:34 PM: │       …27903fb104344e25e3e114d977 │ 12.4 KiB │
1:38:34 PM: │       …cc58d061f418426300d0884db8 │ 55.4 KiB │
1:38:34 PM: │       …efecb44cf476d95c8a2d123bde │ 21.5 KiB │
1:38:34 PM: │       …2128c7301005dd159d23565838 │ 11.1 KiB │
1:38:34 PM: │       …93bbcd3b9013cac5bd1b9fc94c │ 14.1 KiB │
1:38:34 PM: │       …08d0ca882ba6c6f2adce8df249 │ 12.6 KiB │
1:38:34 PM: │       …d81614ccb2245d8dfb81c345ce │ 56.6 KiB │
1:38:34 PM: │       …ec8428f9a17964fed5d437cc42 │ 21.5 KiB │
1:38:34 PM: │       …77183cec1af8a7ba8d7d182290 │ 11.3 KiB │
1:38:34 PM: │       …f773fe5bad294e1c02b3fa61a1 │ 14.7 KiB │
1:38:34 PM: │       …58f4c046a11c4aa5920c4bef97 │ 12.3 KiB │
1:38:34 PM: │       …a39624c4a3f4ca3e461903666c │ 55.2 KiB │
1:38:34 PM: │       …2bac477757d540ad57ff9a5736 │ 21.5 KiB │
1:38:34 PM: │       …472b2ea17ac01bca2e847148e2 │ 11 KiB   │
1:38:34 PM: │       …c4e596ce7e2fdfd90d5a5c464a │ 14 KiB   │
1:38:34 PM: │       …4601ecdcaf5c4d1411ef177e8b │ 8.32 KiB │
1:38:34 PM: │       …7f589ee957de532e8cb887d209 │ 50.4 KiB │
1:38:34 PM: │       …64e54ecb0c5b5b7711c7d63621 │ 15.4 KiB │
1:38:34 PM: │       …fe776dae29ea783f62ebc3225d │ 7.63 KiB │
1:38:34 PM: │       …658bf21b37083d96210f4cbc51 │ 10.2 KiB │
1:38:34 PM: │       …a36ed539d2b33fd173543dede4 │ 8.43 KiB │
1:38:34 PM: │       …799cb3f1b29dfad816139bad03 │ 51.6 KiB │
1:38:34 PM: │       …0880373b223d9caeedc1cae11c │ 15.8 KiB │
1:38:34 PM: │       …dd680fa1dcdfa2b35019b3849f │ 7.7 KiB  │
1:38:34 PM: │       …da33b59324fbefe468ce6917ab │ 10.3 KiB │
1:38:34 PM: └───────────────────────────────────┴──────────┘
1:38:34 PM: [success] [webpackbar] Mix: Compiled successfully in 5.21s
1:38:34 PM: webpack compiled successfully
1:38:34 PM: 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
1:38:34 PM: PHP Fatal error:  Uncaught Error: Failed opening required '/opt/build/repo/vendor/autoload.php' (include_path='.:/usr/share/php') in /opt/build/repo/please:18
1:38:34 PM: Stack trace:
1:38:34 PM: #0 {main}
1:38:34 PM:   thrown in /opt/build/repo/please on line 18
1:38:34 PM: ​
1:38:34 PM: ────────────────────────────────────────────────────────────────
1:38:34 PM:   "build.command" failed                                        
1:38:34 PM: ────────────────────────────────────────────────────────────────
1:38:34 PM: ​
1:38:34 PM:   Error message
1:38:34 PM:   Command failed with exit code 255: npm run production && php please ssg:generate && php artisan config:cache (https://ntl.fyi/exit-code-255)
1:38:34 PM: ​
1:38:34 PM:   Error location
1:38:34 PM:   In Build command from Netlify app:
1:38:34 PM:   npm run production && php please ssg:generate && php artisan config:cache
1:38:34 PM: ​
1:38:34 PM:   Resolved config
1:38:34 PM:   build:
1:38:34 PM:     command: npm run production && php please ssg:generate && php artisan config:cache
1:38:34 PM:     commandOrigin: ui
1:38:34 PM:     environment:
1:38:34 PM:       - APP_KEY
1:38:34 PM:       - APP_NAME
1:38:34 PM:       - APP_URL
1:38:34 PM:     publish: /opt/build/repo/storage/app/static
1:38:34 PM:     publishOrigin: ui
1:38:35 PM: Caching artifacts
1:38:35 PM: Started saving node modules
1:38:35 PM: Finished saving node modules
1:38:35 PM: Started saving build plugins
1:38:35 PM: Finished saving build plugins
1:38:35 PM: Started saving pip cache
1:38:35 PM: Finished saving pip cache
1:38:35 PM: Started saving emacs cask dependencies
1:38:35 PM: Finished saving emacs cask dependencies
1:38:35 PM: Started saving maven dependencies
1:38:35 PM: Finished saving maven dependencies
1:38:35 PM: Started saving boot dependencies
1:38:35 PM: Finished saving boot dependencies
1:38:35 PM: Started saving composer dependencies
1:38:35 PM: Finished saving composer dependencies
1:38:35 PM: Started saving rust rustup cache
1:38:35 PM: Finished saving rust rustup cache
1:38:35 PM: Started saving go dependencies
1:38:35 PM: Finished saving go dependencies
1:38:37 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:38:37 PM: Creating deploy upload records
1:38:37 PM: Failing build: Failed to build site
1:38:37 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:38:37 PM: Finished processing build request in 41.321266776s
jasonvarga commented 2 years ago

Composer didn't install. You can see in the output that it's complaining about your PHP version.

  • symfony/console v6.1.1 requires php >=8.1 -> your php version (8.0.20) does not satisfy that requirement.

You can remedy this by changing your PHP version to 8.0 locally, doing a composer update, then deploying again.