Tag: heroku

Heroku NODE_ENV环境variables

我正在用Heroku运行一个Node项目作为我的主要部署目标。 在开发环境中,我使用grunt来启动Web服务器,但是在生产环境中,我更愿意直接使用node app启动应用node app 这是我的Procfile: web: bin/web 和bin / web: #!/bin/sh echo "NODE_ENV=" $NODE_ENV if [ "$NODE_ENV" == "production" ]; then echo "Starting the server with node app" node app else echo "Starting the server using grunt" grunt fi 第一个echo是用于debugging的。 heroku日志显示: app[web.1]: NODE_ENV= 基本上,NODE_ENV没有设置。 (和应用程序开始咕噜,而不是node app ) 该文档说:“NODE_ENV环境variables默认为生产,但如果你愿意,你可以覆盖它” 我错过了什么?

无法从本地节点应用程序以sequelize连接到heroku postgresql数据库

我试图从Sequelize的本地nodejs应用程序连接到Heroku postgresql数据库。 我遵循这两个指南,一切都在英雄服务器端的工作完全正常,但我的节点应用程序将不会连接到heroku当我在我的Mac本地运行它。 http://sequelizejs.com/articles/heroku https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku 以下是我如何启动本地应用程序: DATABASE_URL=$(heroku config:get DATABASE_URL) nodemon 得到我: Sequelize: Unable to connect to the database: 但是我通过这样做得到正确的URL: echo $(heroku config:get DATABASE_URL) 这些命令工作正常: heroku pg:psql psql $(heroku config:get DATABASE_URL) 这是我的nodejs代码: var match = process.env.DATABASE_URL.match(/postgres:\/\/([^:]+):([^@]+)@([^:]+):(\d+)\/(.+)/) sequelize = new Sequelize(match[5], match[1], match[2], { dialect: 'postgres', protocol: 'postgres', port: match[4], host: match[3], logging: false }) sequelize .authenticate() […]

无法在Heroku上运行Phantomjs +节点

我已经成功地让Phantomjs能够在Heroku上工作,但现在我遇到了node.js的phantomjs-node接口问题(请参阅https://github.com/sgentle/phantomjs-node )。 当我试图初始化幻影时,我看到一个10-15秒的延迟,然后: > phantom stdout: ReferenceError: Can't find variable: socket phantom stdout: phantomjs://webpage.evaluate():1 phantomjs://webpage.evaluate():1 phantomjs://webpage.evaluate():1 您可以通过以下步骤重现问题,或通过在https://github.com/matellis/phantom-test下拉testing应用程序 git init phantom-test cd phantom-test heroku apps:create # create node app as per Heroku instructions here https://devcenter.heroku.com/articles/nodejs # copy bin and lib folders from http://phantomjs.googlecode.com/files/phantomjs-1.6.1-linux-x86_64-dynamic.tar.bz2 into root of your new project # if you don't do this step […]

Heroku bash:node:找不到命令

在Heroku上启动节点应用程序之前,有没有人有这个错误? 2012-10-17T20:28:52+00:00 heroku[web.1]: Starting process with command `node app.js` 2012-10-17T20:28:53+00:00 app[web.1]: bash: node: command not found 似乎Heroku应用程序缺less节点。 该应用程序本地启动就好了。 领class开始和节点app.js. { "name": "app-name", "description": "some desc", "version": "0.0.1", "private": true, "engines": { "node": "0.8.12", "npm": "1.1.49" }, "dependencies": { "express" : "2.5.9", "mongoose" : ">=2.6.0", "colibri" : "*", "jade": ">= 0.0.1" } }

在相同的Heroku app / dyno上部署后端和前端

在我的项目的根,我有一个frontend和backend文件夹。 这两个文件夹都包含一个package.json ,列出它们的依赖关系。 如何在部署应用程序时告诉Heroku在两个文件夹上运行npm install ? 看来Heroku预计默认情况下只有一个package.json文件。 我需要用Procfile做些什么吗? Heroku的文档似乎没有多less关于我的具体问题。 谢谢您的帮助!

在Heroku上设置node.js服务器的端口

我使用以下行启动了一个node.js服务器来设置端口: app.set('port', process.env.PORT || 8080); 这意味着,它应该读取PORT envvariables或默认为8080,就像在本地运行一样。 在Heroku上它们都没有发生,服务器总是使用默认的端口80.任何想法如何改变它? heroku config PORT: 8080

如何设置Gruntfile在heroku上使用指南针/ sass?

我已经用grunt buildpack成功设置了我的heroku应用程序。 当我将我的Node.js应用程序推送到heroku时,它将运行适当的grunt任务。 我想要的是使用“grunt-contrib-compass”包来编译我的.scss文件。 但是那需要指南针的可执行文件,我不知道该怎么做。 我已经检查过heroku文档,并且看到过时的文档描述了用ruby设置指南针 …但是我还没有看到任何最近的文档用于设置Node.js。 有任何想法吗?

让Heroku的config vars在node.js中工作

我有一个节点的应用程序,有这样一行: var ip = process.env.IP || 'http://localhost'; 我使用passport-facebook节点包来定义来自Facebook身份validation的callback: passport.use(new FacebookStrategy({ clientID: FACEBOOK_APP_ID, clientSecret: FACEBOOK_APP_SECRET, callbackURL: ip + ":" + port + "/auth/facebook/callback" }, function(accessToken, refreshToken, profile, done) { // asynchronous verification, for effect… process.nextTick(function () { return done(null, profile); }); } )); Heroku似乎并不知道process.env.IP所以我继续在Heroku中定义一个config varvariables: heroku config:add process.env.IP=http://app.mydomain.com debugging服务器我发现ip不是我想要的,但它的http://localhost与我在第一行代码中定义的回退相同。 如何让节点从heroku正确读取configurationvariables?

为什么我的Flask应用程序在Heroku上被检测为node.js

我最近对heroku托pipe的Flask应用程序的结构进行了一些更改,现在,heroku已经决定将其作为Python应用程序的Node.js应用程序intead进行检测。 我的应用程序使用python(Flask)作为后端api,而javascript作为前端。 我所做的更改包括将npm和bower集成到我的应用程序中,以简化应用程序的JavaScript开发。

如何在heroku中显示来自node.js的所有console.log?

我已经为node.js部署了一个node.js应用程序,但无法从我的应用程序中看到完整的console.log语句。 我在用: heroku logs 显示了一些日志logging,但看起来不是完整的日志。 是否有一个node.js包从部署的应用程序发送电子邮件? 电子邮件从我的本地机器顺便工作正常。 电邮地址: console.log('try to send email hold on'); var nodemailer = require("nodemailer"); var smtpTransport = nodemailer.createTransport({ service: "Gmail", auth: { user: "myemail@gmail.com", pass: "mypw" } }); smtpTransport.sendMail({ from: "Dikkebil", // sender address to: "myemail@gmail.com", // comma separated list of receivers subject: "Error body", // Subject line text: 'Error body: […]