Tag: heroku

如何利用Heroku的“postdeploy”脚本在预置的Heroku PostgreSQL数据库中创build表?

我正在Heroku上设置一个Web应用程序。 我希望别人能够自己使用它,所以我试图创build一个“部署到Heroku”button,以包含在我的存储库的自述文件。 跟着Heroku的文档1,2 ,我创build了一个app.json文件,概述了Herokuconfiguration应用程序所需的所有内容。 这是我的app.json文件的样子: { "name": "[title]", "author": "[author]", "description": "[desc]", "repository": "[https://github.com/[user]/[repo]", "logo": "[url]", "addons": [ "heroku-postgresql:hobby-dev", "wwwhisper:solo" ], "scripts": { "postdeploy": "node server/models/database.js" }, "env": { "TZ": "America/Los_Angeles" } } 正如你所看到的, postdeploy脚本应该调用database.js脚本,如下所示: const pg = require('pg'); const connectionString = process.env.DATABASE_URL; const client = new pg.Client(connectionString); client.connect(); client.query('CREATE TABLE IF NOT EXISTS table_name […]

Socket io 2.0.4找不到模块'./utf8'(Heroku)

我尝试安装并运行一个简单的应用程序与nodeJs套接字io和heroku.When我本地运行应用程序时,我没有得到任何错误,但是当我尝试在heroku上运行应用程序,我得到以下错误: Error: Cannot find module './utf8' at Function.Module._resolveFilename (module.js:489:15) at Function.Module._load (module.js:439:25) at Module.require (module.js:517:17) at require (internal/module.js:11:18) at Object.<anonymous> (/app/node_modules/engine.io-parser/lib/index.js:5:12) at Module._compile (module.js:573:30) at Object.Module._extensions..js (module.js:584:10) at Module.load (module.js:507:32) at tryModuleLoad (module.js:470:12) at Function.Module._load (module.js:462:3) at Module.require (module.js:517:17) at require (internal/module.js:11:18) at Object.<anonymous> (/app/node_modules/engine.io-parser/index.js:2:18) at Module._compile (module.js:573:30) at Object.Module._extensions..js (module.js:584:10) at Module.load (module.js:507:32) Ι使用heroku控制台在node_modules […]

当Node.js项目部署到Heroku时,本地模块不能导入

当我的项目在本地运行时,我可以导入myModule 。 然而,当我把我的项目推到Heroku,我跑了麻烦导入myModule。 我得到错误TypeError: myModule.myFunc is not a function 。 当我输出模块到控制台时, {} 。 但是,当我从同一个目录中导入文件时,一切都很好。 另外,我可以从目录中导入其他模块。 我用下面的语法导入,一切都正确。 var myModule = require('../myModuleFolder/myModule.js'); 任何洞察到Heroku的触发是什么?

使用webpack和node.js运行Heroku

首先是上下文,这是我的文件结构: bundle.js package.json package-lock.json .gitignore /.git /node_modules /src form.js form.css index.html json.js 这是我的package.json : { "name": "transcriber-form-helper", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "node node_modules/webpack/bin/webpack.js ./src/form.js bundle.js" }, "author": "", "license": "ISC", "dependencies": { "jquery": "^3.2.1" }, "devDependencies": { "css-loader": "^0.28.7", "style-loader": "^0.19.0", […]

Hubot启动时自动加载.env

我正在使用Heroku开发一个Hubot框架的应用程序。 我在Heroku上设置了一些configurationvariables,当我部署我的代码时,我的process.env引用工作正常。 但是,我在使用configurationvariables设置本地开发系统进行testing时遇到了麻烦。 我有一个.env文件,并从Heroku获取所有configurationvariables。 但是,当我在命令行启动我的应用程序时,.env文件似乎不会被加载。 我已经添加了hubot-env (就像Hubotbuild议的那样 – 从一个文件中加载环境variables ),并且可以每次使用命令启动我的应用程序时手动加载我的.env文件 hubot env load –filename=[filename] 我想自动化这个,所以这个命令会自动执行,当我启动我的机器人。 我可以在哪里configuration?

不能让英雄服务器与Firebase数据库一起工作? Heroku崩溃?

好吧,我真的只是在这里错过了一个基本的理解。 我想要做的是: 使用firebase的托pipe和数据库 – 现在这个工程,因为我最初设置应用程序作为一个Firebase应用程序 只使用Heroku的服务器 – 我的理由是谷歌云function是有限的,不会让我做一个免费的计划等外部API调用 我有点新的这个设置,但到目前为止,我已经遵循https://firebase.google.com/docs/admin/setup和Heroku的设置说明。 我的项目 – 公众是我的公共HTML /文件: 我运行npm安装,并希望有英雄运行server.js作为我的服务器代码。 本地和正式运行,我一直在使用 firebase serve firebase deploy 这两个工作没有错误,但没有服务器代码运行。 尝试heroku open or heroku local ,它崩溃与错误: firebase实验:function:shell 2017-12-02T18:19:41.474319 + 00:00 app [web.1]:npm ERR! file sh 2017-12-02T18:19:41.471559 + 00:00 app [web.1]:sh:1:firebase:not found 这里是server.js,只是尝试一个简单的testing: const express = require('express'); const app = express(); const functions = require('firebase-functions'); const […]

PM2 Heroku部署无法启动应用程序

我按照这里的方向: http : //pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/ 尝试将testing应用推送到heroku并获取错误消息: [PM2] Spawning PM2 daemon with pm2_home=/app/.pm2 2017-12-04T22:35:51.928946+00:00 app[web.1]: [PM2] PM2 Successfully daemonized 2017-12-04T22:35:51.955730+00:00 app[web.1]: [PM2][ERROR] script not found : /app/dist/server.js 2017-12-04T22:35:51.955882+00:00 app[web.1]: script not found : /app/dist/server.js 在我的package.json中: "scripts": { "preinstall": "npm install pm2 -g", "start": "pm2 start ./dist/server.js -i 1 –attach" } 这是文件夹结构: 我可以通过npm start在本地npm start 。 任何想法或线索为什么发生这种情况?

Heroku:无法编译dependency中的node.js

所以我试图弄清楚这一点,我有最难的时候理解为什么它的失败? 我已经尝试了一些在线方法,我在我的.gitignore node_modules ,所以我不明白为什么它坏了。 我也试过了 git push -f heroku master 尽pipe它应该强制它工作,但它没有工作。 所以对我来说没有什么意义。 这是terminal的回应

了解Heroku在部署Nodejs应用程序时在日志中encryption错误

我正在尝试将我的node.js应用程序部署到Heroku。 它在本地工作完全正常,但是当我尝试部署它,我不断得到这个: 2017-12-12T17:32:18.220591+00:00 app[web.1]: > ev@1.0.0 start /app 2017-12-12T17:32:18.220592+00:00 app[web.1]: > node app.js 2017-12-12T17:32:18.220592+00:00 app[web.1]: 2017-12-12T17:32:18.898850+00:00 heroku[web.1]: Process exited with status 1 2017-12-12T17:32:18.910740+00:00 heroku[web.1]: State changed from starting to crashed 2017-12-12T17:32:18.819322+00:00 app[web.1]: module.js:664 2017-12-12T17:32:18.819338+00:00 app[web.1]: return process.dlopen(module, path._makeLong(filename)); 2017-12-12T17:32:18.819339+00:00 app[web.1]: ^ 2017-12-12T17:32:18.819339+00:00 app[web.1]: 2017-12-12T17:32:18.819340+00:00 app[web.1]: Error: /app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header 2017-12-12T17:32:18.819341+00:00 app[web.1]: at Object.Module._extensions..node (module.js:664:18) […]

Coffeescript – 手表开关不能与节点0.4.7一起工作

对coffeescript编译器的–watch指令不适用于node.js 0.4.7。 怎么修? (目前需要在Heroku上部署0.4.7节点。)