基金会站点部署到Heroku [英] Foundation Sites deploy to Heroku

查看:79
本文介绍了基金会站点部署到Heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用基础站点​​创建了一个站点.它使用的是使用Foundation CLI的标准安装.

I've created a site using foundation sites. It's using the standard install using the Foundation CLI.

我已经使用foundation watch在本地运行该站点.当我将其推送到Heroku时,构建会在Heroku控制台中成功完成,但是当我在浏览器中访问该站点时,只会收到应用程序错误.

I've got the site running locally using foundation watch. When I push this to Heroku the build succeeds in the Heroku console but when I visit the site in a browser I only get an application error.

Heroku支持人员说我应该在启动脚本中使用$PORT,但是我不知道在哪里配置它.这是第一次安装,这似乎也很奇怪.

Heroku support has said I should be using $PORT in my startup script but I don't know where to configure this. This also seems strange as it's the first install.

有人有类似的问题吗?

推荐答案

以下是我在您的应用中发现的一些问题.

Here are some of the issue i find in your app.

首先heroku不会安装任何devDependencies,因此请确保构建所需的所有依赖项都在依赖项列表中.

Heroku搜索用于启动应用程序的Procfile.如果找不到,它将按照标准程序进行.

Heroku searches for Procfile, which is used to launch app. If it doesnt find that, it will go with standard procedure.

以您的情况

它运行npm start.哪个调用gulp来运行build,server和watch(这不是必需的).

It runs npm start. Which calls gulp to run build, server and watch( which is not necessary ).

第二个heroku动态分配端口号.但是您的服务器任务绑定了config.yml中的静态端口号8000.这样可能会使您的应用失败.

Second heroku assign PORT number dynamically. But your server task binds a static port number 8000 from config.yml. So that may fail your app.

您不需要在heroku中使用基础监视,因为不需要文件的监视模式

You dont need to use foundation watch in heroku as watch mode of files are not needed

您需要运行服务器并为您的文件提供服务器

You are required to run a server and server your files

我的建议是在用gulp构建应用程序后使用expressJS服务器(因为我已经使用过它)

My advice is to use expressJS server( because i have used it ) after your done building your app with gulp

在您的启动脚本(package.json)中,您可以编写类似

In your start script(package.json), you can write something like

"scripts": {
    "start": "gulp && node server.js",
    "build": "gulp build --production"
  }

其中server.js是expressjs服务器文件. 这是示例,说明了如何编写它.

where server.js is expressjs server file. here's an example how you can write it.

希望您的问题现在将减少.

Hope your problem will have less issues now.

更不用说您的github仓库了,但以下几点可能对您以及您的客户/用户或任何人有帮助.

Not to say about your github repo, but here are some points that might helpfull for you as well as for your clients/users or anybody.

  1. 为什么要将所有node_modules和bower_components上传到github.当您拥有各自的json文件时,任何人都可以 npm install bower install 下载所有必需的软件包.
  2. 随着 push clone 大小的增加,上载node_modules和bower_components会让您头疼.
  1. Why you have uploaded all node_modules and bower_components to github. When you have their respective json file, anyone can do npm install or bower install to download all required packages.
  2. Uploading node_modules and bower_components will be a headache for you as your push and clone size increases.

这篇关于基金会站点部署到Heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆