Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26171] 7.1.1.GA throwing error - Cannot read property 'version' of undefined

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsCLI
Labelsn/a
ReporterLuke Taylor
AssigneeUnknown
Created2018-05-17T14:02:24.000+0000
Updated2018-06-29T21:30:08.000+0000

Description

Upgrading to 7.1.1.GA and trying to carry out commands with the CLI and receiving a thrown error "TypeError: Cannot read property 'version' of undefined, full error output is below. I can build with exact same setup on Titanium 7.1.0.GA, so most likely an underlying library change between the two versions. OSX 10.13.4 Appc CLI 7.0.3 Titanium 7.1.1.GA Titanium CLI 5.1.0 Node 8.11.2 NPM 6.0.1
/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:1034
            callback();
            ^
TypeError: Cannot read property 'version' of undefined
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:258:23
    at Array.forEach (<anonymous>)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:257:10
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3824:9
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:460:16
    at iteratorCallback (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:1034:13)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:944:16
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3821:13
    at apply (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:21:25)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:56:12
---------------------------------------------
    at run (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:60:8)
    at finalize (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:226:8)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:244:14
    at ChildProcess.<anonymous> (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:61:3)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
---------------------------------------------
    at run (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:60:8)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:241:5
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3816:26
    at eachOfArrayLike (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:1039:9)
    at eachOf (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:1087:5)
    at _parallel (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3815:5)
    at Object.parallelLimit [as parallel] (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3898:3)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:178:9
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3824:9
---------------------------------------------
    at Object.run (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:60:8)
    at find (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:97:13)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:4025:5
    at process (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:2332:17)
    at Immediate.<anonymous> (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:2136:16)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
---------------------------------------------
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:2135:9
    at apply (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:21:25)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:56:12
    at _insert (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:2248:9)
    at Object.push (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:2294:13)
    at findExecutable (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:114:8)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:145:5
    at ChildProcess.<anonymous> (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:61:3)
---------------------------------------------
    at run (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/subprocess.js:60:8)
    at detectOSX (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js:139:4)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3816:26
    at replenish (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:982:17)
    at iterateeCallback (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:967:17)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:944:16
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:3821:13
    at apply (/Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:21:25)
    at /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/async/dist/async.js:56:12
---------------------------------------------
    at Object.run (/Users/luketaylor/.nvm/versions/node/v8.11.2/lib/node_modules/titanium/node_modules/node-appc/lib/subprocess.js:59:8)
    at find (/Users/luketaylor/.nvm/versions/node/v8.11.2/lib/node_modules/titanium/node_modules/node-appc/lib/subprocess.js:96:14)
    at /Users/luketaylor/.nvm/versions/node/v8.11.2/lib/node_modules/titanium/node_modules/node-appc/node_modules/async/dist/async.js:3894:5
    at process (/Users/luketaylor/.nvm/versions/node/v8.11.2/lib/node_modules/titanium/node_modules/node-appc/node_modules/async/dist/async.js:2299:17)
    at Immediate.<anonymous> (/Users/luketaylor/.nvm/versions/node/v8.11.2/lib/node_modules/titanium/node_modules/node-appc/node_modules/async/dist/async.js:2112:16)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
"

Comments

  1. Ewan Harris 2018-05-17

    I think it's possible that https://github.com/appcelerator/node-appc/pull/126 fixes this issue [~ltaylor] could you try two things for me please 1. Open /Users/luketaylor/Library/Application Support/Titanium/mobilesdk/osx/7.1.1.GA/node_modules/node-appc/lib/jdk.js, could you change the code in the forEach loop on line 257 to be
       console.log(jdk);
       results.jdks[jdk.version + '_' + jdk.build] = jdk;
       
       // only add the first jdk as it's probably the JAVA_HOME based one
       	if (results.version === null) {
       		mix(results, jdk);
       	}
       });
       
    2. Could you try the patch in https://github.com/appcelerator/node-appc/pull/126, on line 256 before if (jdks.length) add jdks = jdks.filter(function (jdk) { return jdk; });
  2. Luke Taylor 2018-05-17

    @Ewan Harris Was unsure what difference other than the console.log was from (1), but I have patched in (2) and that has done the trick!
  3. Ewan Harris 2018-05-17

    [~ltaylor] Oops I forgot to ask you upload the output from the console.logs :), could you maybe do that? I have a feeling that this maybe should be fixed earlier in the code than the code in 2
  4. Luke Taylor 2018-05-17

    Okay, I have logged before and after the filter happens... Before
       [ undefined,
         { home: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home',
           version: '9.0.4',
           build: '11',
           executables: 
            { java: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/java',
              javac: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/javac',
              keytool: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/keytool',
              jarsigner: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/jarsigner' },
           architecture: '64bit' },
         undefined,
         undefined ]
       
    After
       [ { home: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home',
           version: '9.0.4',
           build: '11',
           executables: 
            { java: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/java',
              javac: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/javac',
              keytool: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/keytool',
              jarsigner: '/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/jarsigner' },
           architecture: '64bit' } ]
       

JSON Source