使用CodeBuild持续部署加载AWS Elastic Beanstalk测试网站时,出现此错误:
Warning: require(/var/app/current/clu/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/app/current/clu/public/index.php on line 24 Fatal error: require(): Failed opening required '/var/app/current/clu/public/../vendor/autoload.php' (include_path='.:/usr/share/pear7:/usr/share/php') in /var/app/current/clu/public/index.php on line 24
似乎没有生成作曲家文件。
但是,在CodeBuild日志中,它们是。
[Container] 2020/02/24 03:21:34 Running command composer install
03:21:38
Loading composer repositories with package information
03:21:38
Installing dependencies (including require-dev) from lock file
03:21:38
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
03:21:38
Package operations: 89 installs, 0 updates, 0 removals
03:21:38
- Installing doctrine/inflector (v1.3.0): Downloading (connecting...)Downloading (100%)
03:21:38
- Installing doctrine/lexer (1.1.0): Downloading (connect..
...
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: [32mfacade/ignition[39m
Discovered Package: [32mfideloper/proxy[39m
Discovered Package: [32mlaravel/tinker[39m
Discovered Package: [32mnesbot/carbon[39m
Discovered Package: [32mnunomaduro/collision[39m
[32mPackage manifest generated successfully.[39m
这是我的buildspec.yml代码:
version: 0.2
phases:
install:
commands:
export DEBIAN_FRONTEND=noninteractive
#Install php7.1
apt-get update
apt-get install -y software-properties-common
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
apt-get update
# Install PHP
apt-get install -y php7.2\
php7.2-ldap \
php7.2-xml \
php7.2-xmlrpc \
php7.2-zip \
php7.2-mysql \
php7.2-mbstring \
php7.2-mcrypt \
php7.2-gd \
php7.2-readline \
php7.2-opcache \
php7.2-xdebug \
php7.2-dom \
php-xdebug \
php7.2-curl \
unzip
phpenmod xdebug
#Install composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php ;
php -r "unlink('composer-setup.php');" ;
mv composer.phar /usr/local/bin/composer
build:
commands:
- echo Build started on `date`
- echo Installing composer deps
- composer install
post_build:
commands:
- echo Build completed on `date`
我的laravel文件系统没有供应商文件夹,因为我希望它是通过composer安装生成的。
非常感谢您提供帮助,我已经尝试了很多事情。无法使它正确生成。
我还通过ssh检查了该文件夹,而不是grrr。就像它在其他地方生成一样。
谢谢!
答案 0 :(得分:1)
将以下内容添加到我的buildspec.yml中,可以将供应商文件上传到工作服务器。
artifacts:
files:
- '**/*'
proxy:
upload-artifacts: yes
logs: yes