ibm-mobilefirstibm-cloudibm-mobile-services

Creating an application with MobileFirst Services Starter on Bluemix


I'm following the tutorial: https://www.ibm.com/developerworks/library/mo-android-mobiledata-app/index.html

When the application starts, it is blocked inmediately and stops running.

In the activity information channel appears the following information:

An instance of the app has been blocked: 2 error(s) occurred: * 2 error(s) occurred: * Exited with stat...

I have left everything by default, and I tried in different regions (US South, UK, ..) and the behavior is the same...

I do not know what the problem is.

Regards


Solution

  • I was able to recreate the issue. The error I get in the logs is this:

    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR /home/vcap/app/node_modules/loopback/node_modules/strong-globalize/node_modules/os-locale/index.js:2
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR const execa = require('execa');
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR ^^^^^
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR SyntaxError: Use of const in strict mode.
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at exports.runInThisContext (vm.js:73:16)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Module._compile (module.js:443:25)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Object.Module._extensions..js (module.js:478:10)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Module.load (module.js:355:32)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Function.Module._load (module.js:310:12)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Module.require (module.js:365:17)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at require (module.js:384:17)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Object.<anonymous> (/home/vcap/app/node_modules/loopback/node_modules/strong-globalize/lib/globalize.js:13:16)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Module._compile (module.js:460:26)
    2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR     at Object.Module._extensions..js (module.js:478:10)
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Linux 4.4.0-75-generic
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! node v0.12.18
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! npm  v2.15.11
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! HelloTodo@1.0.0 start: `node .`
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Exit status 1
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR!
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Failed at the HelloTodo@1.0.0 start script 'node .'.
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! This is most likely a problem with the HelloTodo package,
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! not with npm itself.
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Tell the author that this fails on your system:
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR!     node .
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! You can get information on how to open an issue for this project with:
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR!     npm bugs HelloTodo
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Or if that isn't available, you can get their info via:
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR!
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR!     npm owner ls HelloTodo
    2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! There is likely additional logging output above.
    2017-11-09T12:06:31.21-0600 [APP/PROC/WEB/0] ERR npm ERR! Please include the following file with any support request:
    2017-11-09T12:06:31.21-0600 [APP/PROC/WEB/0] ERR npm ERR!     /home/vcap/app/npm-debug.log
    

    This is error is caused because ES6 is not enabled by default in Node.js 0.12. As @pradeep sg said, that blog post and the starter are fairly out of date. If you look at the code of the starter, it is specifying Node version 0.12 in the package.json.

    https://github.com/ibm-bluemix-mobile-services/bms-hellotodo-strongloop

    To fix this for your local environment, download the starter code, and modify the package.json as follows:

    {
      "name": "HelloTodo",
      "description": "A simple todo list application created with StringLoop, LoopBack and Bluemix Mobile Services",
      "version": "1.0.0",
      "main": "server/server.js",
      "scripts": {
        "start": "node ."
      },
      "author": "Anton Aleksandrov",
      "dependencies": {
        "bluemix-appid": "1.x",
        "compression": "^1.0.3",
        "cors": "^2.5.2",
        "loopback": "^2.22.0",
        "loopback-boot": "^2.6.5",
        "loopback-component-explorer": "^2.1.0",
        "loopback-connector-mysql": "^2.2.0",
        "loopback-datasource-juggler": "^2.39.0",
        "passport": "^0.3.2",
        "serve-favicon": "^2.0.1"
      },
      "repository": {
        "type": "git",
        "url": "https://github.com/ibm-bluemix-mobile-services/bms-hellotodo-strongloop.git"
      },
      "engines": {
        "node": "8.9.x"
      },
      "license": "Apache-2.0"
    

    Then do a bx cf push to redeploy, so it uses a newer engine of Node.

    After I did that, it worked:

    screenshot of starter


    If you want to look for the latest content being produced from the Mobile team, check out their Dashboard here on Bluemix:

    https://console.bluemix.net/developer/mobile/dashboard

    That will provide the newest starter kits, demos, blogs, and content that they're releasing.

    I will notify them about this issue so the deploy works correctly.