I've been working on a rails app using google-maps-4-rails to visualize the bicycle stations. The app worked fine on my local server, but I am getting errors while deploying to Heroku. I tried launching it locally in production environment but it works correctly. I am at loss, and since it is my first venture into front-end, I don't know how to handle this situation.
I've added the nodejs buildpack earlier to solve some other issue, maybe it's causing problems. I also formated the package.json, though I am not entirely sure if it's correct. Earlier problems were connected to yarn not being available on heroku.
My package.json :
{
"name": "sample_app",
"private": true,
"engines": {
"yarn": "1.7.0"
},
"scripts": {
"start": "node server"
},
"dependencies": {},
"keywords": [
"node",
"heroku"
]
}
My logs from heroku :
: Starting process with command `npm start`
2019-04-20T09:54:42.459328+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-20T09:54:42.009377+00:00 app[web.1]:
2019-04-20T09:54:42.009398+00:00 app[web.1]: > sample_app# start /app
2019-04-20T09:54:42.009399+00:00 app[web.1]: > node server
2019-04-20T09:54:42.009401+00:00 app[web.1]:
2019-04-20T09:54:42.337386+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-20T09:54:42.337425+00:00 app[web.1]: throw err;
2019-04-20T09:54:42.337427+00:00 app[web.1]: ^
2019-04-20T09:54:42.337429+00:00 app[web.1]:
2019-04-20T09:54:42.337431+00:00 app[web.1]: Error: Cannot find module '/app/server'
2019-04-20T09:54:42.337433+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-20T09:54:42.337434+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-20T09:54:42.337436+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-20T09:54:42.337438+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-20T09:54:42.337439+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-20T09:54:42.343303+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-04-20T09:54:42.343921+00:00 app[web.1]: npm ERR! errno 1
2019-04-20T09:54:42.345414+00:00 app[web.1]: npm ERR! sample_app# start: `node server`
2019-04-20T09:54:42.345427+00:00 app[web.1]: npm ERR! Exit status 1
2019-04-20T09:54:42.349073+00:00 app[web.1]: npm ERR!
2019-04-20T09:54:42.349078+00:00 app[web.1]: npm ERR! Failed at the sample_app# start script.
2019-04-20T09:54:42.349081+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-04-20T09:54:42.352338+00:00 app[web.1]:
2019-04-20T09:54:42.352554+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-04-20T09:54:42.353207+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-04-20T09_54_42_347Z-debug.log
2019-04-20T09:54:42.440910+00:00 heroku[web.1]: Process exited with status 1
I am not sure what files may be helpful, please let me know If I can provide any other that would be of assistance
Heroku thinks your Rails app is a Nodejs app because there is a package.json file and no Procfile. That package.json file should be completely unnecessary for a Rails app, try removing it.
Related
Update after making changes:
/app/index.js:27
2016-12-07T16:03:32.984832+00:00 app[web.1]: liveQuery: {
2016-12-07T16:03:32.984833+00:00 app[web.1]: ^^^^^^^^^
2016-12-07T16:03:32.984838+00:00 app[web.1]: SyntaxError: Unexpected identifier
2016-12-07T16:03:32.984839+00:00 app[web.1]: at Object.exports.runInThisContext (vm.js:76:16)
2016-12-07T16:03:32.984839+00:00 app[web.1]: at Module._compile (module.js:542:28)
2016-12-07T16:03:32.984840+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2016-12-07T16:03:32.984840+00:00 app[web.1]: at Module.load (module.js:487:32)
2016-12-07T16:03:32.984840+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2016-12-07T16:03:32.984841+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2016-12-07T16:03:32.984842+00:00 app[web.1]: at Module.runMain (module.js:604:10)
2016-12-07T16:03:32.984842+00:00 app[web.1]: at run (bootstrap_node.js:394:7)
2016-12-07T16:03:32.984842+00:00 app[web.1]: at startup (bootstrap_node.js:149:9)
2016-12-07T16:03:32.984843+00:00 app[web.1]: at bootstrap_node.js:509:3
2016-12-07T16:03:32.991077+00:00 app[web.1]:
2016-12-07T16:03:32.998460+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2016-12-07T16:03:32.998644+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-12-07T16:03:32.998784+00:00 app[web.1]: npm ERR! node v6.9.1
2016-12-07T16:03:32.998903+00:00 app[web.1]: npm ERR! npm v3.10.8
2016-12-07T16:03:32.999025+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-12-07T16:03:32.999126+00:00 app[web.1]: npm ERR! parse-server-example#1.4.0 start: `node index.js`
2016-12-07T16:03:32.999210+00:00 app[web.1]: npm ERR! Exit status 1
2016-12-07T16:03:32.999307+00:00 app[web.1]: npm ERR!
2016-12-07T16:03:32.999390+00:00 app[web.1]: npm ERR! Failed at the parse-server-example#1.4.0 start script 'node index.js'.
Here is the index.js
// Example express application adding the parse-server module to expose Parse
// compatible API routes.
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;
var S3Adapter = require('parse-server').S3Adapter;
if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://ADDRESS',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'APPID',
masterKey: process.env.MASTER_KEY || 'MASTERKEY',
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
fileKey: 'FILEKEY',
filesAdapter: new S3Adapter(
process.env.AWS_ACCESS_KEY_ID || "AKIAIEHF3KZUEYJTUOJA",
process.env.AWS_SECRET_ACCESS_KEY || "AWS_SECRET_ACCESS_KEY",
process.env.BUCKET_NAME || "BUCKET_NAME"
)
liveQuery: {
classNames: ["Users", "FritchDirectory"] // List of classes to support for query subscriptions
}
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey
var app = express();
// Serve static assets from the /public folder
app.use('/public', express.static(path.join(__dirname, '/public')));
// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
res.status(200).send('I dream of being a website. Please star the parse-server repo on GitHub!');
});
// There will be a test page available on the /test path of your server url
// Remove this before launching your app
app.get('/test', function(req, res) {
res.sendFile(path.join(__dirname, '/public/test.html'));
});
var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});
// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer);
//curl -X POST -H "X-Parse-Application-Id:1bIi1xMZLEnYu1axn0SlDXu9xm7wSet25Y0hyvys" -H "Content-Type: application/json" -d '{"HerCell":1337,"title":"Sean Plott","address":321}' http://localhost:1337/parse/classes/FritchDirectory
//export DATABASE_URI=mongodb://address
The output that I get for my Heroku App running Parse server is this:
Please tell me what must be going wrong with this? I have followed all the guidelines for migrating from parse to heroku, but just do not understand what is going on her.e
2016-12-06T16:52:43.317740+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-06T16:52:46.453553+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-06T16:52:50.162903+00:00 app[web.1]:
2016-12-06T16:52:50.162917+00:00 app[web.1]: > parse-server-example#1.4.0 start /app
2016-12-06T16:52:50.162918+00:00 app[web.1]: > node index.js
2016-12-06T16:52:50.162919+00:00 app[web.1]:
2016-12-06T16:52:50.317661+00:00 app[web.1]: /app/index.js:23
2016-12-06T16:52:50.317664+00:00 app[web.1]: filesAdapter: new S3Adapter(
2016-12-06T16:52:50.317665+00:00 app[web.1]: ^^^^^^^^^^^^
2016-12-06T16:52:50.317666+00:00 app[web.1]: SyntaxError: Unexpected identifier
2016-12-06T16:52:50.317667+00:00 app[web.1]: at Object.exports.runInThisContext (vm.js:76:16)
2016-12-06T16:52:50.317667+00:00 app[web.1]: at Module._compile (module.js:542:28)
2016-12-06T16:52:50.317668+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2016-12-06T16:52:50.317668+00:00 app[web.1]: at Module.load (module.js:487:32)
2016-12-06T16:52:50.317669+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2016-12-06T16:52:50.317669+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2016-12-06T16:52:50.317670+00:00 app[web.1]: at Module.runMain (module.js:604:10)
2016-12-06T16:52:50.317671+00:00 app[web.1]: at run (bootstrap_node.js:394:7)
2016-12-06T16:52:50.317672+00:00 app[web.1]: at startup (bootstrap_node.js:149:9)
2016-12-06T16:52:50.317672+00:00 app[web.1]: at bootstrap_node.js:509:3
2016-12-06T16:52:50.350495+00:00 app[web.1]:
2016-12-06T16:52:50.364668+00:00 app[web.1]: npm ERR! Linux 3.13.0-100-generic
2016-12-06T16:52:50.364914+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-12-06T16:52:50.365113+00:00 app[web.1]: npm ERR! node v6.9.1
2016-12-06T16:52:50.365226+00:00 app[web.1]: npm ERR! npm v3.10.8
2016-12-06T16:52:50.365352+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-12-06T16:52:50.365448+00:00 app[web.1]: npm ERR! parse-server-example#1.4.0 start: `node index.js`
2016-12-06T16:52:50.365582+00:00 app[web.1]: npm ERR! Exit status 1
2016-12-06T16:52:50.367495+00:00 app[web.1]: npm ERR!
2016-12-06T16:52:50.367496+00:00 app[web.1]: npm ERR! Failed at the parse-server-example#1.4.0 start script 'node index.js'.
2016-12-06T16:52:50.367497+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-12-06T16:52:50.367498+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the parse-server-example package,
2016-12-06T16:52:50.367498+00:00 app[web.1]: npm ERR! not with npm itself.
2016-12-06T16:52:50.367499+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-12-06T16:52:50.367499+00:00 app[web.1]: npm ERR! node index.js
2016-12-06T16:52:50.367500+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-12-06T16:52:50.367501+00:00 app[web.1]: npm ERR! npm bugs parse-server-example
2016-12-06T16:52:50.367501+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-12-06T16:52:50.367502+00:00 app[web.1]: npm ERR! npm owner ls parse-server-example
2016-12-06T16:52:50.367503+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-12-06T16:52:50.372745+00:00 app[web.1]:
2016-12-06T16:52:50.373075+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-12-06T16:52:50.373250+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-12-06T16:52:50.467906+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-06T16:52:50.458594+00:00 heroku[web.1]: Process exited with status 1
2016-12-06T16:52:50.367499+00:00 app[web.1]: npm ERR! node index.js
2016-12-06T16:52:50.367500+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-12-06T16:52:50.367501+00:00 app[web.1]: npm ERR! npm bugs parse-server-example
2016-12-06T16:52:50.367501+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-12-06T16:52:50.367502+00:00 app[web.1]: npm ERR! npm owner ls parse-server-example
2016-12-06T16:52:50.367503+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-12-06T16:52:50.372745+00:00 app[web.1]:
2016-12-06T16:52:50.373075+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-12-06T16:52:50.373250+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-12-06T16:52:50.467906+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-06T16:52:50.458594+00:00 heroku[web.1]: Process exited with status 1
Your error is here (check arrow below):
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
fileKey: process.env.FILE_KEY || 'optionalFileKey', // For migrated apps, this is necessary to provide access to files already hosted on parse.com.
serverURL: process.env.SERVER_URL || 'http://localhost:1337', // Don't forget to change to https if needed
filesAdapter: new S3Adapter(
process.env.AWS_ACCESS_KEY_ID || "AWS_ACCESS_KEY_ID",
process.env.AWS_SECRET_ACCESS_KEY || "AWS_SECRET_ACCESS_KEY",
process.env.BUCKET_NAME || "BUCKET_NAME"
)
}); // <----------------
liveQuery: {
classNames: ["Users", "FritchDirectory"] // List of classes to support for query subscriptions
}
Where the arrow is, closes the api initialization making
liveQuery: {
classNames: ["Users", "FritchDirectory"] // List of classes to support for query subscriptions
}
invalid Javascript syntax.
The stack trace shows it as filesAdapter: new S3Adapter cause that's the last thing it recognizes
I don't know your intention but it looks like it needs to be this:
var liveQuery = {
classNames: ["Users", "FritchDirectory"] // List of classes to support for query subscriptions
}
Note the equal sign instead of colon. The former is for property assignment of an object
I just looked at an example.
You want to move the closing brackets down, after the livequery property like so:
filesAdapter: new S3Adapter(
process.env.AWS_ACCESS_KEY_ID || "AWS_ACCESS_KEY_ID",
process.env.AWS_SECRET_ACCESS_KEY || "AWS_SECRET_ACCESS_KEY",
process.env.BUCKET_NAME || "BUCKET_NAME"
),
liveQuery: {
classNames: ["Users", "FritchDirectory"] // List of classes to support for query subscriptions
}
}); // <----------------
I'm trying to deploy a Ruby on Rails application, with a Node.js front end to Heroku. I'm getting:
Here's my Procfile:
web:bundle exec thin start -p $PORT
Here's my package.json:
{
"name": "collectize",
"version": "1.0.0",
"description": "[Heroku link][heroku]",
"main": "index.js",
"directories": {
"doc": "docs",
"test": "test"
},
"engines": {
"node": "4.1.1",
"npm": "2.1.x"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "./node_modules/.bin/webpack"
"start": "node ./app/assets/javascripts/bundle.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/winterblack/Collectize.git"
"start": "web:bundle exec thin start -p $PORT"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/winterblack/Collectize/issues"
},
"homepage": "https://github.com/winterblack/Collectize#readme",
"dependencies": {
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"flux": "^2.1.1",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"react-router": "^2.5.2",
"webpack": "^1.13.1"
},
"devDependencies": {}
}
Here's my Heroku log:
2016-07-13T05:29:29.266840+00:00 heroku[api]: Release v28 created by wylliamjudd#gmail.com
2016-07-13T05:29:29.266840+00:00 heroku[api]: Deploy 7d61777 by wylliamjudd#gmail.com
2016-07-13T05:29:29.456774+00:00 heroku[slug-compiler]: Slug compilation started
2016-07-13T05:29:29.517376+00:00 heroku[web.1]: Restarting
2016-07-13T05:29:29.518479+00:00 heroku[web.1]: State changed from up to starting
2016-07-13T05:29:32.421302+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-07-13T05:29:33.846617+00:00 heroku[web.1]: Process exited with status 143
2016-07-13T05:29:41.586027+00:00 heroku[web.1]: Starting process with command `npm start`
2016-07-13T05:29:43.343250+00:00 app[web.1]:
2016-07-13T05:29:43.343268+00:00 app[web.1]: > collectize#1.0.0 start /app
2016-07-13T05:29:43.343269+00:00 app[web.1]: > node ./app/assets/javascripts/bundle.js
2016-07-13T05:29:43.343269+00:00 app[web.1]:
2016-07-13T05:29:43.513547+00:00 app[web.1]:
2016-07-13T05:29:43.520060+00:00 app[web.1]: at Object.<anonymous> (/app/app/assets/javascripts/bundle.js:88:4)
2016-07-13T05:29:43.520063+00:00 app[web.1]: at Object.<anonymous> (/app/app/assets/javascripts/bundle.js:43:10)
2016-07-13T05:29:43.520063+00:00 app[web.1]: at Module._compile (module.js:456:26)
2016-07-13T05:29:43.532480+00:00 app[web.1]: npm ERR! This is most likely a problem with the collectize package,
2016-07-13T05:29:43.535942+00:00 app[web.1]:
2016-07-13T05:29:44.242442+00:00 heroku[web.1]: Process exited with status 1
2016-07-13T05:29:44.280956+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-13T05:29:44.282455+00:00 heroku[web.1]: State changed from crashed to starting
2016-07-13T05:29:57.352852+00:00 heroku[web.1]: Starting process with command `npm start`
2016-07-13T05:29:59.471893+00:00 app[web.1]:
2016-07-13T05:29:59.471938+00:00 app[web.1]: > collectize#1.0.0 start /app
2016-07-13T05:29:59.471940+00:00 app[web.1]: > node ./app/assets/javascripts/bundle.js
2016-07-13T05:29:59.471943+00:00 app[web.1]:
2016-07-13T05:29:59.650297+00:00 app[web.1]:
2016-07-13T05:29:59.654711+00:00 app[web.1]: /app/app/assets/javascripts/bundle.js:88
2016-07-13T05:29:59.655117+00:00 app[web.1]: $(document).ready(function () {
2016-07-13T05:29:59.659133+00:00 app[web.1]: at Object.<anonymous> (/app/app/assets/javascripts/bundle.js:88:4)
2016-07-13T05:29:59.659135+00:00 app[web.1]: at __webpack_require__ (/app/app/assets/javascripts/bundle.js:20:30)
2016-07-13T05:29:59.659138+00:00 app[web.1]: at Module.load (module.js:356:32)
2016-07-13T05:29:59.659139+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2016-07-13T05:29:59.659140+00:00 app[web.1]: at Function.Module.runMain (module.js:497:10)
2016-07-13T05:29:59.659141+00:00 app[web.1]: at startup (node.js:119:16)
2016-07-13T05:29:59.672227+00:00 app[web.1]: npm ERR! node v0.10.30
2016-07-13T05:29:59.672464+00:00 app[web.1]: npm ERR! npm v2.1.18
2016-07-13T05:29:59.672884+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-07-13T05:29:59.673045+00:00 app[web.1]: npm ERR! collectize#1.0.0 start: `node ./app/assets/javascripts/bundle.js`
2016-07-13T05:29:59.673873+00:00 app[web.1]: npm ERR! This is most likely a problem with the collectize package,
2016-07-13T05:29:59.674006+00:00 app[web.1]: npm ERR! not with npm itself.
2016-07-13T05:29:59.674125+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-07-13T05:29:59.674412+00:00 app[web.1]: npm ERR! You can get their info via:
2016-07-13T05:29:59.674578+00:00 app[web.1]: npm ERR! npm owner ls collectize
2016-07-13T05:29:59.674919+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-07-13T05:29:59.677307+00:00 app[web.1]:
2016-07-13T05:30:00.517992+00:00 heroku[web.1]: State changed from starting to crashed
2016-07-13T05:30:00.501781+00:00 heroku[web.1]: Process exited with status 1
2016-07-13T05:30:01.842475+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=collectize.herokuapp.com request_id=111967a3-b265-4447-8e7e-da8a723b5b48 fwd="24.176.249.167" dyno= connect= service= status=503 bytes=
On my local machine I need to run:
~$ bundle install
~$ npm install
~$ webpack
~$ thin start
Do I have to have Heroku run node bundle.js in order to get my React components? If so, why don't I have to do that on my machine? The difference between what happens on Heroku, and what happens on my local machine is the primary thing I need clarification on.
This line in the log seems important:
/app/app/assets/javascripts/bundle.js:88
$(document).ready(function () {
I've almost never run a JavaScript file with Node.js (aside from some debugging); I almost always work with JavaScript in a web application in HTML. I tried running node bundle.js locally, and got ReferenceError: $ is not defined. I tried changing it to document.addEventListener("DOMContentLoaded", ...but then I just got the same error for document is not defined.
I honestly have no idea where to go from here. I don't understand why Heroku needs to run node bundle.js, or whether it even does.
I did try deleting the Procfile and just putting "bundle exec thin start -p $PORT" as my start script in my package.json, and that actually got my website "up", but with no React components (and so completely blank).
I've found that with Heroku, you need to include a favicon. The app will crash otherwise.
Include this in your <head>:
<link href="/images/favicon.png" rel="shortcut icon" type="image/png"/>
Adjust the path, filename, and type accordingly.
The issue is Heroku is setup to serve either a Rails backend or a Node.js isomorphic frontend. You can't do both in the same app.
Use two apps. myapp-api.herokuapp.com is Rails and myapp-web.herokuapp.com is React isomorphic. I personally host the React frontend on netlify.com which is a static hosting service.
Build using webpack during the build and serve static files from Rails. webpack-rails looks promising.
Remove the nodejs buildpack, and decide how you want to serve your frontend. Separate app, or static build.
Apparently all I had to do was delete my nodejs buildpack and readd it with index 1. My website immediately started working when I did that. Then I deleted the start script from my package.json, and the website still worked.Then I deleted my procfile and the website still works.
So, the only issue was the order of the buildpacks, no procfile required, no start script required.
I have built a rails app following the model presented here:
http://mikeatlas.github.io/realtime-rails/
I am using Rails with the realtime-rails gem and redis. My application is working in my development environment and i want to move it to Heroku. I have already setup a Redis database at Redis-to-go and I now want to make whatever changes are necessary for the realtime-gem and associated socket-io server setup. At a minimum, I will need to modify the production portion of my application_controller:
def realtime_server_url
if Rails.env.development?
return 'HTTPLOCALHOST:5001'
end
if Rails.env.production?
return 'PRODUCION-LOCATION'
end
end
I have deployed the socket-io server (realtime-server) that is installed by instructions from the link above for realtime-server to a separate heroku instance. I then made the PRODUCION-LOCATION that url for the realtime -server dyno with port 5001 and both http and https. No joy.
Following the instructions the realtime-server folder was created at the top level of my project folder, parallel to the app folder. Does this mean i should include it in the main repository and somehow have it run from the same dyno as the app? If so, how do i go about starting it? The instructions say to start it by locally with:
cd realtime-server
foreman start
Not clear that I can do that through the heroku cli will be able to run in the same instance and how is it started.
=============
Update
Found documentation on heroku that made me realize, I need to set the REDISCLOUD_URL for the heroku dyno running the realtime-server using:
heroku config:add REDISCLOUD_URL='redis_cloud_url'
and that in production it wasnt using the 5001 port:
if (process.env.NODE_ENV != 'production') {
port = 5001; // run on a different port when in non-production mode.
}
Also, found form console log that the realtime-server was enforcing HTTPS.
Now, the blocking issue seems to be the request of /socket.io/socket.io.js from the realtime-server which returns:
503 (Service Unavailable)
So far, it seems that separating the realtime-server from the rails app repository was the right move.
Looking through the code for the realtime-server to determine how that is routed...
================
Update
i looked at the logs on your advice, thanks. saw that the realtime-server was crashing because it wasnt liking the port, so I tried to set the PORT variable 443, 3000, 5001 variously to no avail using:
heroku config:add PORT='443'
based on this code from the enviornment.js file of the realtime-server:
var port = process.env.PORT || 5001;
if (process.env.NODE_ENV != 'production') {
port = 5001; // run on a different port when in non-production mode.
}
here is an excerpt of logs:
2015-02-22T19:26:45.512317+00:00 heroku[api]: Set PORT config vars by tmt#breakthroughtek.com
2015-02-22T19:26:45.512317+00:00 heroku[api]: Release v5 created by tmt#breakthroughtek.com
2015-02-22T19:26:45.754327+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-22T19:26:48.318928+00:00 heroku[web.1]: Starting process with command `node forever.js`
2015-02-22T19:26:49.540190+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-02-22T19:26:49.540213+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-02-22T19:26:49.957808+00:00 app[web.1]: STARTING ON PORT: 5001
2015-02-22T19:27:44.163425+00:00 heroku[api]: Scale to web=1 by tmt#breakthroughtek.com
2015-02-22T19:27:48.811493+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-02-22T19:27:48.811551+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-02-22T19:27:49.561043+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-22T19:27:49.561720+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-22T19:27:49.534451+00:00 heroku[web.1]: Process exited with status 137
2015-02-22T19:27:51.936860+00:00 heroku[web.1]: Starting process with command `node forever.js`
2015-02-22T19:27:53.289025+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-02-22T19:27:53.289046+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-02-22T19:27:53.703573+00:00 app[web.1]: STARTING ON PORT: 5001
2015-02-22T19:28:51.991836+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-02-22T19:28:51.991836+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-02-22T19:28:52.758191+00:00 heroku[web.1]: Process exited with status 137
2015-02-22T19:28:52.764783+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-22T19:31:22.240362+00:00 heroku[api]: Set PORT config vars by tmt#breakthroughtek.com
2015-02-22T19:31:22.240362+00:00 heroku[api]: Release v6 created by tmt#breakthroughtek.com
2015-02-22T19:31:22.378770+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-22T19:31:24.766187+00:00 heroku[web.1]: Starting process with command `node forever.js`
2015-02-22T19:31:26.316332+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-02-22T19:31:26.316353+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-02-22T19:31:26.717561+00:00 app[web.1]: STARTING ON PORT: 5001
===========
Update
looking at the logs and seeing the system was still picking port 5001, I checked the heroku environement via :
heroku config
and saw that the NODE_ENV variable was not set. Did a:
heroku config:add NODE_ENV='production'
and now the js file is loading. YAY!!! .. Thanks, d.danailov :)
Have to resolve some issue with rails on heroku erring with a missing template error on access to the admin area:
2015-02-22T20:04:36.492199+00:00 app[web.1]: Processing by LocationsController#index as HTML
2015-02-22T20:04:36.497052+00:00 app[web.1]: * "/app/app/views"
2015-02-22T20:04:36.497054+00:00 app[web.1]: * "/app/vendor/bundle/ruby/2.0.0/gems/devise-3.4.1/app/views"
2015-02-22T20:04:36.497059+00:00 app[web.1]: app/controllers/locations_controller.rb:8:in `index'
2015-02-22T20:04:36.497050+00:00 app[web.1]: ActionView::MissingTemplate (Missing template locations/index, application/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
2015-02-22T20:04:36.497062+00:00 app[web.1]:
2015-02-22T20:04:36.497057+00:00 app[web.1]: ):
2015-02-22T20:04:36.497060+00:00 app[web.1]:
2015-02-22T20:04:36.497056+00:00 app[web.1]: * "/app/vendor/bundle/ruby/2.0.0/gems/realtime-0.0.12/app/views"
And of course, the page is working fine in development. So I am going to start with the assumption it has something to do with sprockets/asset pipeline.
But i think this portion may be solved. I will close once I verify I can send realtime msgs.
=============
Update
SOLVED: beware you dont use redis elsewhere in your app.
HEADS UP: i had a sneaky little Redis.new in an initializer that was wiping out my Redis config settings.
most of the solution was setting the NODE_ENV & REDISCLOUD_URL vars for the realitme server running in a separate instance.
I've created simple application with Ruby on Rails and I’ve tried to commit it on Heroku. I’ve followed this Getting Started on Heroku guide,
I finished it and try to open my page but I still see an Error:
Application Error:
An error occurred in the application and your page could not be
served. Please try again in a few moments.
If you are the application owner, check your logs for details.
Anybody know how to deal with it?
I don’t know what was happen but I’ve done this step, unfortunately I have another problem, I run a few commands:
# git add .
# git commit -m "my commit"
On branch master nothing to commit (working directory clean)
# git push heroku
master Everything up-to-date
# heroku open Opening
http ://eerie-meadow-9207.heroku.com/
# heroku restart
Restarting processes... done
# heroku open Opening
http ://eerie-meadow-9207.heroku.com/
And I see a message:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
From heroku logs [timestamps removed for clarity]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:38 -0700
app[web.1]: Processing by StoreController#index as HTML
app[web.1]: Completed 500 Internal Server Error in 3ms
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=13ms status=500 bytes=728
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:38 -0700] "GET / HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com
app[web.1]:
heroku[web.1]: State changed from up to bouncing
heroku[web.1]: State changed from bouncing to created
heroku[web.1]: State changed from created to starting
heroku[web.1]: Starting process with command `thin -p 40376 -e production -R /home/heroku_rack/heroku.ru start`
heroku[web.1]: Process exited
app[web.1]: >> Maximum connections set to 1024
app[web.1]: >> Listening on 0.0.0.0:40376, CTRL+C to stop
app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
heroku[web.1]: State changed from starting to up
app[web.1]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:59-0700
app[web.1]:
app[web.1]: Processing by StoreController#index as HTML
app[web.1]: Completed 500 Internal Server Error in 4ms
app[web.1]:
app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR: relation "products" does not exist
app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
app[web.1]: WHERE a.attrelid = '"products"'::regclass
app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
app[web.1]: ORDER BY a.attnum
app[web.1]: ):
app[web.1]: app/controllers/store_controller.rb:3:in `index'
app[web.1]:
app[web.1]:
app[web.1]: cache: [GET /] miss
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=81ms status=500 bytes=728
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:59 -0700] "GET / HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com
app[web.1]:
app[web.1]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:54:00-0700
app[web.1]: Processing by StoreController#index as HTML
I cannot understand it because on my netbook it works on localhost, any ideas?
Try using the command
heroku run rake db:migrate
Try restarting your app with heroku restart. Assuming your app runs fine locally, this should do the trick. It solved the issue for me as I only refactored the schema and the db:reset did not seem to do the trick.
Most of the time heroku issues are due to lack of privileges to access file system. In order for your application to work on heroku you must make sure it wont try to write anything to disk (but in temporary folder).
The typical example is js/css compiling process, e.g. with compass, for which you will find a solution on their knowledge database: http://devcenter.heroku.com/articles/using-compass
You should look further in the heroku logs see if there is any "permission denied" issue at application startup or during the first requests.
http://www.youtube.com/watch?v=p_3dIPgXgkg
If you already have your application built, go to the point in the video when he begins pushing the sample app to heroku. Unfortunately heroku returns hard to solve errors when uploading 3.1 apps for the first time. Follow the troubleshooting steps in the video and you'll be fine.
I had this issue when I was starting to create a discord bot and make it online. And I figured out the reason for this was using the node latest current version(v17.1), I wasted about 2 days for this and tried downgrading node version to v16.7.And to my surprise it worked!.
So I recommend downgrading to v16.7 or the latest LTS version when you are checking this and do install the current latest version
https://nodejs.org/ca/blog/release/v16.7.0/
Here's the full code
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
// WShen the client is ready, run this code (only once)
client.once('ready', () => {
console.log('Ready!');
});
// Login to Discord with your client's token
client.login(token);
const http = require('http');
const PORT = process.env.PORT || 3000;
const requestListener = function (req, res) {
res.writeHead(200);
res.end('Bot is up and running');
}
const server = http.createServer(requestListener);
server.listen(PORT);
setInterval(function() {
http.get("http://<your app name>.herokuapp.com");
}, 300000); // every 5 minutes (300000)
Note:Last 3 lines of this code is completely additional and what they do is stop heroku from putting app to sleep every 30 minutes
I had the same problem. Have a look at your Procfile and check if you have added the proper command in it such as web: python run.py. I wasn't able to connect then I placed the command heroku logs --tail to see what was the problem and I saw that within my Procfile I had a type mistake such as >>>web: oython run.py<<< making the app not work. So, pay attention to it. command: $echo web: python run.py > Procfile
Just make sure that in the data base, you have allowed "any IP Address" to connect. This is called whitelisting the IP Address. Example: 0.0.0/0. This is because Heroku, each time it spins up, uses a different IP address. But you can change it later using Heroku docs and the docs of your Database service provider.
https://i.stack.imgur.com/Ud2VJ.png
You can use this image as an example which is a screenshot of MongoDB Atlas
Before you start please allow access to your DB network from anywhere.
Well I have also faced this "Application error" problem once
that time I used these command lines
git init
git add .
git commit -m "my first commit"
heroku create YourAppName
git push heroku main
But as you know I got the "Application error"
Then I used these commands
heroku config:set NPM_CONFIG_PRODUCTION=false
git add .
git commit -m "my first commit"
git push heroku main
After that "Application error" problem was solved.
Well, I'm not sure if it works for you or not but I guess you can try at least.
I'm following this tutorial, and have followed the steps to deploying to Heroku.
When I open the application from Heroku, this is what I get:
Heroku | Welcome to your new app!
Why isn't my application showing up?
EDIT: This is what I get when I run heroku logs:
$ heroku logs
←[36m2011-07-29T18:08:11+00:00 heroku[api]:←[0m Add-on add logging:basic by xyz#xyz.com
←[36m2011-07-29T18:08:11+00:00 heroku[api]:←[0m Release v1 created by xyz#xyz.com
←[36m2011-07-29T18:08:13+00:00 heroku[api]:←[0m Add-on update shared-database
←[36m2011-07-29T18:08:13+00:00 heroku[api]:←[0m Release v3 created by xyz#xyz.com
←[33m2011-07-29T18:08:45+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-07-29T18:09:37+00:00 heroku[api]:←[0m Deploy e04b0d1 by xyz#xyz.com
←[36m2011-07-29T18:09:37+00:00 heroku[api]:←[0m Release v4 created by xyz#xyz.com
←[32m2011-07-29T18:09:39+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-07-29T18:09:40+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-07-29T18:09:41+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 59785 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:59785, CT
RL+C to stop
←[32m2011-07-29T18:09:45+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[35m2011-07-29T18:10:08+00:00 heroku[rake.1]:←[0m State changed from created to
starting
←[35m2011-07-29T18:10:10+00:00 app[rake.1]:←[0m Awaiting client
←[35m2011-07-29T18:10:11+00:00 heroku[rake.1]:←[0m State changed from starting t
o up
←[35m2011-07-29T18:10:11+00:00 heroku[rake.1]:←[0m Process exited
←[35m2011-07-29T18:10:12+00:00 heroku[rake.1]:←[0m State changed from up to comp
lete
←[33m2011-07-29T18:13:55+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-07-29T18:14:52+00:00 heroku[api]:←[0m Deploy dbed18f by xyz#xyz.com
←[36m2011-07-29T18:14:52+00:00 heroku[api]:←[0m Release v5 created by xyz#xyz.com
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from up to bounc
ing
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from bouncing to
created
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-07-29T18:14:53+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-07-29T18:14:54+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-07-29T18:14:54+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-07-29T18:14:55+00:00 heroku[web.1]:←[0m Process exited
←[32m2011-07-29T18:14:55+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 49961 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:49961, CT
RL+C to stop
←[32m2011-07-29T18:14:59+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[35m2011-07-29T18:15:21+00:00 heroku[rake.2]:←[0m State changed from created to
starting
←[35m2011-07-29T18:15:24+00:00 heroku[rake.2]:←[0m State changed from starting t
o up
←[35m2011-07-29T18:15:25+00:00 heroku[rake.2]:←[0m State changed from up to comp
lete
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m Started GET "/use
←[31m←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m Processing by UsersController#i
ndex as HTML
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m Completed 500 Internal Server Err
or in 61ms
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m ActiveRecord::StatementInvalid (P
GError: ERROR: relation "users" does not exist
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m : SELECT "users".* FROM "users"):
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m app/controllers/users_controlle
r.rb:5:in `index'
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T19:18:57+00:00 heroku[web.1]:←[0m Idling
←[32m2011-07-29T19:18:58+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-07-29T19:18:58+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-07-29T19:18:58+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-07-29T19:18:59+00:00 heroku[web.1]:←[0m Process exited
←[35m2011-08-02T07:38:42+00:00 heroku[rake.1]:←[0m State changed from created to
starting
←[35m2011-08-02T07:38:44+00:00 app[rake.1]:←[0m Awaiting client
←[35m2011-08-02T07:38:45+00:00 app[rake.1]:←[0m Starting process with command `r
ake db:migrate`
←[35m2011-08-02T07:38:45+00:00 heroku[rake.1]:←[0m State changed from starting t
o up
←[35m2011-08-02T07:38:45+00:00 heroku[rake.1]:←[0m Process exited
←[35m2011-08-02T07:38:46+00:00 heroku[rake.1]:←[0m State changed from up to comp
lete
←[33m2011-08-02T07:58:10+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-08-02T07:59:08+00:00 heroku[api]:←[0m Deploy e5db406 by xyz#xyz.com
←[36m2011-08-02T07:59:08+00:00 heroku[api]:←[0m Release v6 created by xyz#xyz.com
←[33m2011-08-02T07:59:11+00:00 heroku[slugc]:←[0m Slug compilation finished
←[35m2011-08-02T07:59:44+00:00 heroku[rake.2]:←[0m State changed from created to
starting
←[35m2011-08-02T07:59:46+00:00 app[rake.2]:←[0m Awaiting client
←[35m2011-08-02T07:59:46+00:00 app[rake.2]:←[0m Starting process with command `r
ake db:migrate`
←[35m2011-08-02T07:59:47+00:00 heroku[rake.2]:←[0m State changed from starting t
o up
←[35m2011-08-02T07:59:48+00:00 heroku[rake.2]:←[0m Process exited
←[35m2011-08-02T07:59:49+00:00 heroku[rake.2]:←[0m State changed from up to comp
lete
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m Unidling
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m State changed from down to cre
ated
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[32m2011-08-02T08:00:29+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 12972 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:12972, CT
RL+C to stop
←[32m2011-08-02T08:00:32+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[32m2011-08-02T09:01:44+00:00 heroku[web.1]:←[0m Idling
←[32m2011-08-02T09:01:45+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-08-02T09:01:46+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-08-02T09:01:46+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-08-02T09:01:46+00:00 heroku[web.1]:←[0m Process exited
Thanks.
From the logs it looks like you have not migrated your database, because it is looking for a table users. To migrate type this in 'heroku rake db:migrate VERSION=0' and then type 'heroku rake db:migrate'. Take a look here in heroku docs
http://devcenter.heroku.com/articles/database
under the 'Common Issues Migrating to PostgreSQL' section. Also checkout this
http://devcenter.heroku.com/articles/using-the-cli
, for all the commands that you can run from terminal. Since you are using heroku, try and get your local database to also be postgresql, will solve some minor problems later. Remember every time that you push files to heroku, you will want to migrate database, if you have changes something in database structure.
You can use:
heroku logs
to see what is currently happening on the server.
I think the easiest thing would be to start over. Go into the root of your app. Such as myapp and remove the git repo.
cd sites
cd myApp
git rm -r .git
Then log into Heroku and destroy your app in the CMS. After that create a new heroku rails app by going into your directory, creating a new repo, adding your directory, committing as master, creating a heroku app and then pushing to heroku.
git init
git add .
git commit -m 'master'
heroku create
heroku rename myApp
git push heroku master
Then you will need to run your migrations.
heroku rake db:migrate
And if you want to push data from your local machine to production you will want to use the taps gem but make sure you add that to your bundle.
gem 'taps'
And then run bundle again.
bundle
Then you can push your local data if need be.
heroku db:push
Abit late, but i encountered this issue. I was missing foreman in my gemfile
If you're following the railstutorial.org
comment out sqlite 3 (#gem 'sqlite3') in the Gemfile
then:
git add .
git commit -am "fix heroku"
git push heroku
Try this, delete your package.json then npm init. Delete your existing app in Heroku and push back the app with new package.json.