Thursday, November 27, 2014

Bluemix troubleshooting -> A Node.js application cannot be staged

You might not be able to deploy and stage a Node.js application if the command to start the application or package to parse environment variables is not set up correctly.

When you try to deploy an application to Bluemix, you see the error message, Cannot get instances since staging failed.
The problem might happen if the environment variables are parsed incorrectly, or if the command that is used to start the application is not specified.
To resolve the problem, complete one or both of the following actions as necessary:
  • Specify the command that is used to start the application in the package.json file or in the manifest.yml file. For example, in the package.json file, you can use the following code:
    { ... "scripts": { "start": "node app.js" } }
    In the manifest.yml file, you can use the following code:
    applications: - name: testApp ... command: node app.js ...
  • Use the cf-env package to parse the environment variables, instead of doing it manually. For example, you can use the following code:
    cfEnv = require("cf-env")

No comments:

Post a Comment