dsfhd78978 2018-10-02 01:04
浏览 274
已采纳

如何在Heroku上部署静态Web应用程序

I followed instructions from an answer of a similar topic(https://stackoverflow.com/a/17531897/4388482). Well, my app is getting deployed on Heroku but it doesn't work good. I'm getting the following warning

Your project only contains an 'index.php', no 'composer.json'. Using 'index.php' to declare app type as PHP is deprecated and may lead to unexpected behavior.

Do I need to install something maybe?


UPDATE

Project structure was initially this:

Project structure was initially this

I did the following:

  • Installed PHP 5 and composer.
  • I renamed package.json to composer.json and removed package-lock.json.
  • Typed "composer update" command. I got "nothing to install or update" message.
  • Added vendor to gitignore. Pushed changes to heroku.

I got the following warnings

  1. Your 'composer.lock' is out of date!

  2. Composer vendor dir found in project!

  • 写回答

1条回答 默认 最新

  • dongnai1876 2018-10-02 14:31
    关注

    The complaint that Heroku has is regarding this folder.

    For the record, the contents of this folder presently are:

    bootstrap
    fontawesome-free
    jquery-easing
    jquery
    

    What has happened here is that someone has committed dependencies to your version control, which is not good practice. It will work as is, but it is not very easy to do upgrades, especially since you cannot easily see what versions you currently do have.

    There are three ways to go about this.

    1. Decide if these are PHP dependencies, by searching Packagist. There is a Composer dependency for Bootstrap, but you would need to see if the version you are using is available (or whether you can upgrade to one that is available).

    2. Decide if these are JavaScript dependencies, by searching NPM. I wonder if it is worth examining the contents of your package.json in case these are already covered. For what it is worth, I would generally consider these candidates for JavaScript libraries rather than PHP, but do what works for you.

    3. Choose to leave these dependencies committed in the existing vendor folder. It will work, but it is not ideal for the reasons already stated.

    In the last two cases, you could probably get away with a composer.json file thus, which you should commit to the repo:

    {
      "require": {
      }
    }
    

    You could try a composer install after this, to see if it will generate a .lock file on an empty dependency list. If this does generate, then you should commit this also.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?