Thursday 14 December 2017

IBM MobileFirst 8 - Commanding the CLI

As with many of my projects, this is another one in the category of "Tinkering".

In order to better support my current client, I needed a quick-start into the world of IBM MobileFirst Platform (MFP).

I've blogged about MFP before, but mainly in the context of building out a runtime on the WebSphere Liberty Platform: -


but now I wanted to go a little bit further.

I started here: -


and quickly ended up here: -


and: -


Having downloaded and installed the MobileFirst Developer Kit for macOS, as per this: -


I was able to start up the native MobileFirst Server: -

cd /Users/davidhay/MobileFirst-8.0.0.0
./run.sh

….
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
objc[10046]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java (0x100da94c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x100e674e0). One of the two will be used. Which one is undefined.
Listening for transport dt_socket at address: 10777
Launching mfp (WebSphere Application Server 8.5.5.8/wlp-1.0.11.cl50820151201-1942) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_151-b12 (en_GB)
[AUDIT   ] CWWKE0001I: The server mfp has been launched.
[AUDIT   ] CWWKE0100I: This product is licensed for development, and limited production use. The full license terms can be viewed here: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/8.5.5.8/lafiles/en.html
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 

[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/doc/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/mfp-dev-artifacts/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/IBMJMXConnectorREST/

[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/mfpconsole/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/mfpadminconfig/

[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/analytics/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/imfpush/
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://192.168.153.1:9080/mfpadmin/


I then hit the MFP Console: -


and navigated to the Get CLI link: -



At this point, I hit a blocker.

When I tried to use the local version ( having downloaded it from here http://192.168.153.1:9080/mfp-dev-artifacts/mfpdev-cli.tgz ) : -

sudo npm install -g ~/Downloads/mfpdev-cli.tgz 

I saw this: -

npm WARN deprecated minimatch@3.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated express@2.5.11: express 2.x series is deprecated
npm WARN deprecated connect@1.9.2: connect 1.x series is deprecated
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated node-uuid@1.4.7: Use uuid module instead
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm ERR! code E404
npm ERR! 404 Not Found: ibm-strings@0.1.4

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/davidhay/.npm/_logs/2017-12-14T15_19_12_355Z-debug.log


When I tried the version from the net: -

sudo npm install -g mfpdev-cli

I saw this: -

npm WARN deprecated minimatch@3.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated express@2.5.11: express 2.x series is deprecated
npm WARN deprecated connect@1.9.2: connect 1.x series is deprecated
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated node-uuid@1.4.7: Use uuid module instead
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/mfpdev-cli/node_modules/fsevents):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/fsevents-4718b8bb/node_modules/tar' -> '/usr/local/lib/node_modules/.staging/tar-0c43e4b7'

npm ERR! path /Users/mdo-windows-support/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open '/Users/mdo-windows-support/package.json'
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/davidhay/.npm/_logs/2017-12-14T15_19_51_237Z-debug.log

Interestingly, this page: -

doesn't specify dependencies, in terms of NodeJS and NPM.

However, this: -


does say: -

IBM MobileFirst CLI is not supported in the npm version whatever you are trying with.

Try installing the same with npm version 3.10.10 and this should resolve the issue which you are facing.

I checked my versions: -

npm -v

5.5.1

node -v

v8.9.3

Ah, ha :-)

This table: -


helped me find the Node <-> NPM relationship: -

so I went here: -


Having downloaded and installed, I re-checked my versions: -

npm -v

3.10.10

node -v

v7.3.0

Whilst I still struggled with the local version: -

sudo npm install -g ~/Downloads/mfpdev-cli.tgz

npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-adapter-actions
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-android-support
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-app-config
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-app-preview
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-app-pull
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-app-push
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-app-register
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-app-webencrypt
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-app-webupdate
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-cmd-adapter
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-cmd-app
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-cmd-config
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-cmd-info
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-cmd-server
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-cordova-support
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-errors
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-exec
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-ios-support
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-mbs
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-server-support
npm ERR! addLocal Could not install /usr/local/lib/node_modules/mdo-windows-support
npm ERR! addLocal Could not install /usr/local/lib/node_modules/platform-manager
npm ERR! fetch failed https://registry.npmjs.org/mfp-config-xml/-/mfp-config-xml-0.0.3.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/pluggington/-/pluggington-0.3.3.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/ibm-strings/-/ibm-strings-0.1.4.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/mfp-config-xml/-/mfp-config-xml-0.0.3.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/pluggington/-/pluggington-0.3.3.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/ibm-strings/-/ibm-strings-0.1.4.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed https://registry.npmjs.org/mfp-config-xml/-/mfp-config-xml-0.0.3.tgz
npm ERR! fetch failed https://registry.npmjs.org/pluggington/-/pluggington-0.3.3.tgz
npm ERR! fetch failed https://registry.npmjs.org/ibm-strings/-/ibm-strings-0.1.4.tgz
npm ERR! Darwin 17.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "/Users/davidhay/Downloads/mfpdev-cli.tgz"
npm ERR! node v7.3.0
npm ERR! npm  v3.10.10
npm ERR! path /usr/local/lib/node_modules/mdo-adapter-actions
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/usr/local/lib/node_modules/mdo-adapter-actions'
npm ERR! enoent ENOENT: no such file or directory, open '/usr/local/lib/node_modules/mdo-adapter-actions'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/bin/npm-debug.log

I was able to install / use the online version: -

sudo npm install -g mfpdev-cli

which mfpdev

/usr/local/bin/mfpdev

mfpdev -v

8.0.0-2017102406

Now to learn what to do with it ...

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...