Heroku 无法将我的 Laravel 应用程序识别为 PHP 应用程序,并且不执行 composer install

2022-01-21 00:00:00 heroku php composer-php laravel-4

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

I'm trying to publish my Laravel app on Heroku. I have excluded the composer.lock file from .gitignore, and created a Procfile containing

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 myapp@0.0.0 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

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

If I browse to my app, however I get an application error. When I look to my logs, it says

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

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

I suspect that somehow, Heroku didn't do composer install, as it's not in my git output, and maybe it didn't even recognize that my app is an PHP app? To be sure, I also included an empty index.php file in my root. Didn't help.

我在这里错过了什么?

推荐答案

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

I believe I found it. Should better read the lines ("Node.js app detected"). Solved by firing this command :

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

然后再推

相关文章