Search code examples
javascriptnode.jsibm-cloudibm-cloud-toolsibm-cloud-plugin

IBM Bluemix Cloud: IBM SDK for Node.js - Can our apps in Bluemix keep the existing version without auto-updates?


We tried to test IBM Bluemix Cloud and Watson Cloud by running
several Watson Cloud demo node.js apps inside our accounts, we
noticed the following situation:

After we installed the demo apps inside our account, it runs without problem; Because I have not opened this app in Bluemix DevOps tool. So, when this app runs each time, this app does the following based on staging_task.log file:

 "" Installing IBM SDK for Node.js (4.5.0)from cache"""" 

The above app frontend js code is written to work with this SDK and Node.js version.

# Later, I made another copy of the above demo app in our account. It runs without problem. Then, I just opened the above app code in Bluemix DevOps tool and saved the file without touching any code. Then, this version app does not run.

Our investigation shows the following:

  • This staging_task.log file shows this fact: This version app after the above step does this now:
    """ Installing IBM SDK for Node.js (4.6.2) from cache """

    That means Bluemix Cloud automatically use the newer version of Node.js and SDK after the above step.

Another situation we found during our experiments may also be related to this problem:

*We deployed the following Watson demo app around Aug/2016, and we have not resaved any file in this app, so we guess that this demo app still runs in the cached Run Environment (IBM SDK for Node.js Verson 4 ??) in our account in Bluemix. So this demo app runs fast and correctly in our account. https://github.com/watson-developer-cloud/conversation-simple

*After the above deployment, there are several upgrading in Bluemix Cloud and Watson Cloud. The Run Environment many contains IBM SDK for Node.js Verson 6 ??

*In last month, we deployed the above same demo app in our account. We found that this same app runs much slower than the above Aug/2016 deployment. Our guesses are that this demo app code is engineered based on IBM SDK for Node.js Verson 4.

The following Q supports our point: The auto-upgraded IBM SDK for Node.js in Bluemix Cloud or Watson Cloud may

have caused the problem in this Q. Now the IBM SDK for Node.js in Bluemix Cloud may be Version 6, this application may be engineered based on IBM SDK for Node.js Verson 4 (this version is not Node.js version in Package.json, but IBM SDK version) IBM Bluemix node.js native promise support

Our Q:

-Why is the above SDK and Node.js auto-upgraded ?
-How can we force this demo app to use the same version of IBM SDK and Node.js before we decide to upgrade them in Bluemix Cloud? Thus to ensure that our existing apps run as normal.

Any thoughts and suggestions will be appreciated.


Solution

  • You can define node and npm versions in your package.json

    {
       "name":"iot-html5-phone",
       "version":"0.0.1",
       "scripts":{
          "start":"node app.js"
       },
       "dependencies":{
    
       },
       "engines":{
          "node":"0.10.26"
       }
    }