Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28440] Android: Production builds crash if Node 14 is installed

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2021-05-11T10:41:49.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.0
ComponentsAndroid
Labelsandroid, build, node, production
ReporterMichael Gangolf
AssigneeJoshua Quick
Created2021-05-06T18:49:17.000+0000
Updated2021-05-11T10:41:49.000+0000

Description

I know it is not supported officially but I'm giving nodejs 14.16.1 a try. Building debug versions works fine. Just creating a store build will crash with:
[INFO]  Analyzing module files
[INFO]  Processing JavaScript files
[ERROR] TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object
    at writeFile (fs.js:1436:5)
    at go$writeFile (/home/user/.titanium/mobilesdk/linux/10.0.0/node_modules/graceful-fs/graceful-fs.js:139:14)
    at Object.writeFile (/home/user/.titanium/mobilesdk/linux/10.0.0/node_modules/graceful-fs/graceful-fs.js:136:12)
    at /home/user/.titanium/mobilesdk/linux/10.0.0/node_modules/universalify/index.js:10:14
    at new Promise (<anonymous>)
    at Object.writeFile (/home/user/.titanium/mobilesdk/linux/10.0.0/node_modules/universalify/index.js:7:14)
    at AndroidBuilder.writeEnvironmentVariables (/home/user/.titanium/mobilesdk/linux/10.0.0/android/cli/commands/_build.js:2573:11)
    at AndroidBuilder.copyResources (/home/user/.titanium/mobilesdk/linux/10.0.0/android/cli/commands/_build.js:2724:8)
    at async AndroidBuilder.generateAppProject (/home/user/.titanium/mobilesdk/linux/10.0.0/android/cli/commands/_build.js:2261:2)
    at async AndroidBuilder.run (/home/user/.titanium/mobilesdk/linux/10.0.0/android/cli/commands/_build.js:1545:3)
*Setup:* * Fedora Linux 34 * node 14.16.1 * titanium 5.3.1 * ti sdk 10.0.0.RC * alloy 1.16.0

Comments

  1. Joshua Quick 2021-05-06

    This looks like a bug in our build script. https://github.com/appcelerator/titanium_mobile/blob/master/android/cli/commands/_build.js#L2571-L2580 We should change the following...
       await fs.writeFile(
       	envVarsFile,
       	// for non-development builds, DO NOT WRITE OUT ENV VARIABLES TO APP
       	this.writeEnvVars ? JSON.stringify(process.env) : {}
       );
       
    ...to quote the empty curly braces like this...
       this.writeEnvVars ? JSON.stringify(process.env) : '{}'
       
  2. Joshua Quick 2021-05-07

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12782
  3. Michael Gangolf 2021-05-08

    Thanks, working fine (y)

JSON Source