Heroku 无法将我的 Laravel 应用程序识别为 PHP 应用程序,并且不进行 Composer 安装

2024-04-22

我正在尝试在 Heroku 上发布我的 Laravel 应用程序。 我已从.gitignore中排除了composer.lock文件,并创建了一个包含

web: vendor/bin/heroku-php-apache2 public

我创建了我的应用程序

heroku create myapp;
git push heroku master;

然后我得到以下输出:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags heroku master:master 
Pushing to https://git.heroku.com/myapp.git
POST git-receive-pack (1914 bytes)
remote: Compressing source files... done.        
remote: Building source:        
remote: 
remote: -----> Node.js app detected        
remote: -----> Resetting git environment        
remote: 
remote:        PRO TIP: Specify a node version in package.json        
remote:        See https://devcenter.heroku.com/articles/nodejs-support        
remote: 
remote: -----> Defaulting to latest stable node: 0.10.35        
remote: -----> Downloading and installing node        
remote: -----> Exporting config vars to environment        
remote: -----> Installing dependencies        
remote:        npm WARN package.json [email protected] /cdn-cgi/l/email-protection No repository field.        
remote: -----> Cleaning up node-gyp and npm artifacts        
remote: -----> Building runtime environment        
remote: -----> Discovering process types        
remote:        Procfile declares types -> web        
remote: 
remote: -----> Compressing... done, 9.6MB        
remote: -----> Launching... done, v5        
remote:        https://myapp.herokuapp.com/ deployed to Heroku        
remote: 
remote: Verifying deploy... done.        
To https://git.heroku.com/myapp.git
   5b1c663..0dff021  master -> master
updating local tracking ref 'refs/remotes/heroku/master'
Completed successfully

但是,如果我浏览到我的应用程序,则会收到应用程序错误。 当我查看我的日志时,它说

app[web.1]: bash: vendor/bin/heroku-php-apache2: No such file or directory

我怀疑不知何故,Heroku 没有安装 Composer,因为它不在我的 git 输出中,也许它甚至没有识别出我的应用程序是 PHP 应用程序? 可以肯定的是,我还在根目录中包含了一个空的 index.php 文件。没有帮助。

我在这里缺少什么?


我相信我找到了。应该更好地阅读这些行(“检测到 Node.js 应用程序”)。 通过触发此命令解决:

heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php

并再次推动

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Heroku 无法将我的 Laravel 应用程序识别为 PHP 应用程序,并且不进行 Composer 安装 的相关文章

随机推荐