2

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.

eGlobeBiz
  • 87
  • 1
  • 10

2 Answers2

3

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"
   }
}
Hogan
  • 69,564
  • 10
  • 76
  • 117
Ram Vennam
  • 3,536
  • 1
  • 12
  • 19
  • *Thank you for this info. I specified this in package.json ("node": "^4.5.0" ) – eGlobeBiz Jan 10 '17 at 20:03
  • The Node.js 4.5.0. is installed. But the above mentioned app still does not run. The staging_task.log file after this step still shows this: """ Installing IBM SDK for Node.js (4.6.2) from cache """. This IBM SDK is not for Node.js (4.5.0). In the following kind of package.json, where to define this (IBM SDK for Node.js 4.5.0 )? https://github.com/watson-developer-cloud/conversational-agent/blob/master/package.json . I guess that this newer version of IBM SDK may have caused the problem. Thanks – eGlobeBiz Jan 10 '17 at 20:15
  • Bluemix Doc (SDK for Nodejs) says the following "The sdk-for-nodejs buildpack is used when the application contains a package.json file in the root directory" . – eGlobeBiz Jan 13 '17 at 20:25
  • Found more info about IBM SDK here: https://developer.ibm.com/node/sdk/ – eGlobeBiz Jan 13 '17 at 20:43
  • AWS SDK for JavaScript in Node.js: https://aws.amazon.com/sdk-for-node-js/ – eGlobeBiz Jan 13 '17 at 20:44
0

Use:

"engines":{
   "node":"4.5.0"
}

( no carets or tildes )

jarkko
  • 76
  • 8
  • Thank you for this advice. we tried this, this app still does not run. – eGlobeBiz Jan 13 '17 at 19:59
  • But did it still use "(4.6.2) from cache" ? If it works locally, this is what I've sometimes done to replicate bluemix build problems. 1. Checkout fresh version of app (or remove node_modules from old one). 2. Run "npm install". That way you get the latest dependencies, which seems to happen with bluemix. – jarkko Jan 16 '17 at 05:16
  • Thank you for your input. [But did it still use "(4.6.2) from cache" ?] The cached Node.js version in our above app that runs well is Node.js version 4.5.0 – eGlobeBiz Jan 16 '17 at 17:57
  • Jackko, Good to hear your experiences with Bluemix and advice. So far based on the current situation of Bluemix Cloud, the Bluemix users are forced to upgrade their existing app based on the upgraded IBM SDK and Watson SDK. Bluemix and Watson Cloud management need to make Bluemix Cloud easier for its users in the future. – eGlobeBiz Jan 17 '17 at 03:07