Heroku reports "no app specified" on Windows command line - node.js

I have a node.js application running on Heroku. I've used the (Windows) command line to initialize the app with heroku create, and I can hit the production website and see that it's running correctly. All's good.
But when I try to run simple commands, like heroku ps, from the directory in which the app lives, Heroku responds with a "no app specified" error:
C:\dev\iq>heroku ps
! No app specified.
! Run this command from an app folder or specify which app to use with --app APP.
I've read in other posts that you can avoid having to use the --app APP syntax with every command if you configure git like so:
git config heroku.remote heroku
However, after doing so, Heroku still complains that the app wasn't specified for simple command line requests. I've verified that .git/config has been updated appropriately:
C:\dev\iq>type .git\config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "heroku"]
url = git#heroku.com:aqueous-mountain-xxxx.git
fetch = +refs/heads/*:refs/remotes/heroku/*
[heroku]
remote = heroku
I've just reinstalled the latest version of Heroku:
C:\dev\iq>heroku --version
heroku/toolbelt/3.2.2 (i386-mingw32) ruby/1.9.3
What am I missing?

The 'heroku' command requires the '--app' parameter to target a given application, unless you run it from a application folder (clone of the Git repo containing your application).

From my experience, this error occurs when the code is not pushed to heroku (git push heroku master) before running heroku ps.

Related

Deploy a NodeJS app to Heroku

I've followed the getting started guide to deploy a nodejs application to heroku:
I reached to this stage in the tutorial
When I try to write the command:
heroku create
It gives me this error:
UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate
What can be the problem?
Try to do this:
Edit Git config text file (with my favorite line-ending neutral app like Notepad++) located at:
C:\Program Files (x86)\Git\etc\gitconfig
In the [http] block, add an option to disable sslVerify. It looked like this when I was done:
[http]
sslVerify = false
sslCAinfo = /bin/curl-ca-bundle.crt
The answer is related to this
The problem was that I have a web filter on my internet, A content filter and it was blocking the command
heroku create
from going through.
Run the following line:
npm config set strict-ssl false
For Windows 10:
Go to System variable (Windows logo key > type: "environment variables" > click Environment Variables button)
Check/Set Variable SSL_CERT_DIR=YourCetrFolder
Certificate folder Example:

Heroku Redis To Go

From command prompt I try adding Redis as heroku addons:create redistogo:nano
I get the following error
Creating redistogo:nano on MyProjectName... !!
Couldn't find that app.
I tried logging-in & installing from Heroku/Redistogo
But Heroku ask for CC information even if I select free version of RedisToGo.
Is this normal on Heroku site?
You should use this command:
$ heroku addons:create redistogo:nano --app YourAPPName
... Creating redistogo:nano on ⬢ YourAPPName... free
... Created redistogo-URL-for-your-APP as REDISTOGO_URL
... Use heroku addons:docs redistogo to view documentation

(remote rejected) master -> master (pre-receive hook declined), Push rejected, failed to compile Node.js app

I know that there's couple posts like this one, but solution of any of them works for me.
Here is what I receive when I go for git push heroku master:
Please support. Ignoring node_modules is not working.
Docpad app - package.json file is updated according to docpad's manual.
I also have Procfile set up as in the link above.
PS. I have tried to deploy docpad app via openshift, but while Im going with manual from http://docpad.org/docs/deploy/ I receive error at step 5.
The application 'appname' is configured for git reference deployments but the
artifact provided ('https://github.com/myusername/appname#master') is a url.
Please provide a git reference to deploy (branch, tag or commit SHA1) or
configure your app to deploy from binaries with 'rhc configure-app appname
--deployment-type binary'.
If I configure myapp to deployment-type binary it isnt working neither.
The plugin which heroku tries to install returned 404 and the installation fails due to that.
Verify that the plugin is indeed public and not something you have wrote or used locally.
There is no package with this name hosted on the registry you use.
Remove the line with "docpad-plugin-blah": "2" from your package.json file. That line was provided in the docs simply to show you how to install plugins, but there's no such plugin as blah.
"dependencies": {
"docpad": "6"
},
I strongly recommend that you read through the Getting Started on OpenShift to get an overview of the development workflow using Git.
That being said, and if you really meant to use git reference deployments and you know why you are using them, then read through the Managing Deployments section on the developers page of OpenShift and find out how to properly set up git reference deployments. For instance, 'https://github.com/myusername/appname#master' is not a valid git url and therefore it cannot be cloned.

failure to push to heroku on git deploying node server

Im using heroku for testing a server I have followed other examples about this but I keep getting the same error that I dont see anywhere. I have even tried deleting my repo and my heroku app and starting again but i get the same error when using
git push heroku master.
$ git push heroku master
fatal: unable to access 'https://git.heroku.com/football-app-development.git/': Could not resolve host: git.heroku.com
`
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "heroku"]
url = https://git.heroku.com/football-app-development.git
fetch = +refs/heads/*:refs/remotes/heroku/*
`
Any help would be great!
If anyone else has this issue I got it to work by uninstall got and the heroku tool belt and install both again.

Set `process.env.commit` on Heroku push

I'm using NPM's scripts.postinstall to build our application using GulpJS when we push it to Heroku:
"postinstall": "./node_modules/.bin/gulp build --require coffee-script/register"
I want to be able to set an environment variable at this time with the value of the commit hash. This will then be referenced in files as a cachebuster, e.g.:
<script type="text/javascript" src="/index.{{ process.env.commit }}.js"></script>
I can use git-rev to easily get this value asynchronously but I want it stored on an environment level. How can I set a custom Node environment variable?
If I'm going about this the wrong way and there's a better solution please let me know (I can only find methods to set NODE_ENV and not the process.env object itself).
You cannot do this via a postinstall script: the heroku command won't be available in the build environment. You can create your own lightweight deployment script that runs the command on your machine when a successful build occurs however:
#!/bin/sh
git push heroku master && heroku config:set COMMIT=$(git rev-parse --short HEAD)
To note, I got confirmation of this from Heroku support directly. This was their response:
There isn't an installation of heroku toolbelt on the slug compiler. If you need to set an environment variable as part of the push then you'll have to do it on your machine rather than the Heroku compiler.
Solution I've found is to use the heroku config system to set custom environment variables:
git = require "git-rev"
exec = require "exec-sync"
gulp.task "commit", ->
git.long (hash) ->
exec "heroku config:set COMMIT=#{ hash }"
Needs further testing but for now it works (also, because the command is run on the server there's no need to use heroku config:push).
You can now add this metadata with this labs feature from heroku !
heroku labs:enable runtime-dyno-metadata -a <app name>

Resources