Heroku doesn't recognize my Laravel app as PHP app, and does not do composer install

本小妞迷上赌 提交于 2020-01-01 05:16:10

问题


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

I created my app with

heroku create myapp;
git push heroku master;

Then I get the following output:

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

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.

What am I missing here?


回答1:


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

and pushing again




回答2:


Haha, just simply drop the package.json in your laravel project. And then Heroku will detect your app as a php project.




回答3:


Be sure to include the trailing slash on public: public/. This was my issue - I am using Laravel and got a Image source not readable and NotReadableException in AbstractDecoder.php line 302: because it thought at AbstractDecoder->init('/app/public') in AbstractDriver.php line 64 was a file, not a folder.



来源:https://stackoverflow.com/questions/27741478/heroku-doesnt-recognize-my-laravel-app-as-php-app-and-does-not-do-composer-ins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!