expo / turtle

Standalone app builder service
MIT License
385 stars 29 forks source link

"Error : Unterminated quoted string" when trying to run turtle setup:android #306

Closed seba9999 closed 2 years ago

seba9999 commented 3 years ago

New Issue Checklist

I'm trying to integrate an apk generating on my gitlab CI and I'm facing this error while just trying to check if everything's fine with setup:android.

Here's my gitlab-ci.yml :

deploy-apk:
  stage: deploy
  image: node # I've also tried with this custom image which seems that has already installed turtle :  tmprimitivo/expo-turtle-build:stable
  script:
    - apt-get update
    - apt-get install -y openjdk-8-jre-headless
    - echo "Install the app ..."
    - npm install
    - echo "Install successfull !"
    - npm install -g turtle-cli --legacy-peer-deps #--legacy-peer-deps is mandatory since there's a bug with npm versions > 6
    - turtle setup:android --sdk-version 40.0.1
    - echo "Everything's ready"
  allow_failure: true

In addition I can tell that I'm working behind a proxy but I've configured all http_proxy settings ( IMO ) Added like this in the gitlab-ci :

variables:
      HTTP_PROXY: $PROXY
      HTTPS_PROXY: $PROXY
      http_proxy: $PROXY
      https_proxy: $PROXY
      JAVA_OPTS: -Dhttp.proxyHost=$PROXY -Dhttp.proxyPort=$PORT -Dhttps.proxyHost=$PROXY -Dhttps.proxyPort=$PORT"

Maybe it's related to the WARN: Failed to check for turtle-cli update thing ?

Unterminated quoted string while trying to run setup:android

/root/.turtle/androidDependencies/sdk/tools/bin/sdkmanager: 2: eval: Syntax error: Unterminated quoted string

Command :

turtle setup:android --sdk-version 40.0.1
Complete output when running turtle, including the stack trace and command used
 $ npm install -g turtle-cli --legacy-peer-deps
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated topo@2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated @hapi/pinpoint@2.0.0: Moved to 'npm install @sideway/pinpoint'
npm WARN deprecated @hapi/formula@2.0.0: Moved to 'npm install @sideway/formula'
npm WARN deprecated topo@3.0.3: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated hoek@4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated hoek@5.0.4: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated xmldom@0.1.27: Deprecated due to CVE-2021-21366 resolved in 0.5.0
npm WARN deprecated @hapi/address@4.1.0: Moved to 'npm install @sideway/address'
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/joi@17.1.1: Switch to 'npm install joi'
npm WARN deprecated joi@11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated joi@13.7.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
added 2038 packages, and audited 2039 packages in 7m
106 packages are looking for funding
  run `npm fund` for details
18 vulnerabilities (9 low, 9 high)
To address all issues, run:
  npm audit fix
Run `npm audit` for details.
$ turtle -V
0.21.2
$ turtle setup:android --sdk-version 40.0.1
Apr 13 17:10:20 turtle[2706] WARN:  Failed to check for turtle-cli update.
  err: Error: Unable to perform cache refresh for /root/.cache/expo/turtle-cli-updates.json: TimeoutError: Promise timed out after 2000 milliseconds
      at Cacher.getAsync (/@expo/xdl@59.1.0/src/tools/FsCache.ts:107:15)
      at Object.checkAsync (/@expo/xdl@59.1.0/src/tools/ModuleVersion.ts:23:43)
      at checkForUpdateAsync (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:62:50)
      at Command. (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:19:7)
  platform: "android"
Apr 13 17:10:20 turtle[2706] INFO:  Downloading Android SDK
  platform: "android"
  buildPhase: "setting up environment"
Apr 13 17:10:28 turtle[2706] INFO:  Decompressing Android SDK
  platform: "android"
  buildPhase: "setting up environment"
Apr 13 17:10:37 turtle[2706] INFO:  Configuring Android SDK, this may take a while
  platform: "android"
  buildPhase: "setting up environment"
Apr 13 17:10:37 turtle[2706] INFO:  /root/.turtle/androidDependencies/sdk/tools/bin/sdkmanager: 2: eval: Syntax error: Unterminated quoted string
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 13 17:10:37 turtle[2706] INFO:  /root/.turtle/androidDependencies/sdk/tools/bin/sdkmanager: 2: eval: Syntax error: Unterminated quoted string
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 13 17:10:37 turtle[2706] INFO:  /root/.turtle/androidDependencies/sdk/tools/bin/sdkmanager: 2: eval: Syntax error: Unterminated quoted string
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 13 17:10:37 turtle[2706] INFO:  /root/.turtle/androidDependencies/sdk/tools/bin/sdkmanager: 2: eval: Syntax error: Unterminated quoted string
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 13 17:10:37 turtle[2706] INFO:  /root/.turtle/androidDependencies/sdk/tools/bin/sdkmanager: 4: eval: Syntax error: Unterminated quoted string
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 13 17:10:37 turtle[2706] INFO:  /root/.turtle/androidDependencies/sdk/tools/bin/sdkmanager: 2: eval: Syntax error: Unterminated quoted string
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 13 17:10:37 turtle[2706] ERROR: Failed to setup environment for android builds
  err: Error: ./configureAndroidSdk.sh exited with non-zero code: 1
      at ChildProcess.completionListener (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
      at Object.onceWrapper (node:events:476:26)
      at ChildProcess.emit (node:events:369:20)
      at ChildProcess.emit (node:domain:470:12)
      at maybeClose (node:internal/child_process:1067:16)
      at Socket. (node:internal/child_process:453:11)
      at Socket.emit (node:events:369:20)
      at Socket.emit (node:domain:470:12)
      at Pipe. (node:net:666:12)
      ...
      at spawnAsync (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
      at Object.spawnAsyncThrowError (/@expo/xdl@59.1.0/src/detach/ExponentTools.ts:111:19)
      at _configureSdk (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/sdk.ts:54:23)
      at Object.ensureAndroidSDKIsPresent [as default] (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/sdk.ts:34:7)
      at prepareAndroidEnv (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/index.ts:70:21)
      at Object.setup [as default] (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/index.ts:58:3)
      at Object.setup [as default] (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/setup.ts:15:12)
      at setupAction (/usr/local/lib/node_modules/turtle-cli/src/bin/commands/setup.ts:33:5)
      at /usr/local/lib/node_modules/turtle-cli/src/bin/commands/setup.ts:22:40
      at Command. (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:23:12)
  platform: "android" 

Environment

Expo CLI 4.3.5 environment info:
    System:
      OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch)
      Shell: 4.4.12 - /bin/bash
    Binaries:
      Node: 15.14.0 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/local/bin/yarn
      npm: 7.7.6 - /usr/local/bin/npm
    npmPackages:
      expo: ~40.0.0 => 40.0.1 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2 
      react-native-web: ^0.15.5 => 0.15.5 
    npmGlobalPackages:
      expo-cli: 4.3.5
    Expo Workflow: managed
wkozyra95 commented 3 years ago

unterminated quoted string refers to

JAVA_OPTS: -Dhttp.proxyHost=$PROXY -Dhttp.proxyPort=$PORT -Dhttps.proxyHost=$PROXY -Dhttps.proxyPort=$PORT"

sdkmanager script is running this line

eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $SDKMANAGER_OPTS -classpath "\"$CLASSPATH\"" com.android.sdklib.tool.sdkmanager.SdkManagerCli "$APP_ARGS"
seba9999 commented 3 years ago

Oh dear lord !

I'm so sorry ! This is "just" a typo error ! Thank you very much ! Wasn't searching in this way at all !

Btw do you have clue about the "next error" ... Which seems to be linked to the proxy this time ?

java.net.ConnectException: Connection refused (Connection refused)

The only linked issue is this one

To answer @dsokal question there : I'm "forced" to use a proxy by my company settings ... Thus I'm trying to do this through gitlab-ci which runs locally under my company proxy :/

What does he means by

we'll be moving away from turtle-cli soon

Expo will change this workflow ?

Stack trace :

$ turtle setup:android --sdk-version 40.0.1
Apr 15 14:22:58 turtle[2710] WARN:  Failed to check for turtle-cli update.
  err: Error: Unable to perform cache refresh for /root/.cache/expo/turtle-cli-updates.json: TimeoutError: Promise timed out after 2000 milliseconds
      at Cacher.getAsync (/@expo/xdl@59.1.0/src/tools/FsCache.ts:107:15)
      at Object.checkAsync (/@expo/xdl@59.1.0/src/tools/ModuleVersion.ts:23:43)
      at checkForUpdateAsync (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:62:50)
      at Command. (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:19:7)
  platform: "android"
Apr 15 14:22:58 turtle[2710] INFO:  Downloading Android SDK
  platform: "android"
  buildPhase: "setting up environment"
Apr 15 14:23:06 turtle[2710] INFO:  Decompressing Android SDK
  platform: "android"
  buildPhase: "setting up environment"
Apr 15 14:23:13 turtle[2710] INFO:  Configuring Android SDK, this may take a while
  platform: "android"
  buildPhase: "setting up environment"
Apr 15 14:23:14 turtle[2710] INFO:  Warning: java.net.ConnectException: Connection refused (Connection refused)
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:14 turtle[2710] INFO:  Warning: Failed to download any source lists!
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:15 turtle[2710] INFO:  Warning: java.net.ConnectException: Connection refused (Connection refused)
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:15 turtle[2710] INFO:  Warning: Failed to download any source lists!
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:15 turtle[2710] INFO:  Warning: Failed to find package platforms;android-28
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:16 turtle[2710] INFO:  Warning: java.net.ConnectException: Connection refused (Connection refused)
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:16 turtle[2710] INFO:  Warning: Failed to download any source lists!
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:16 turtle[2710] INFO:  Warning: Failed to find package platform-tools
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:16 turtle[2710] INFO:  Warning: java.net.ConnectException: Connection refused (Connection refused)
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:16 turtle[2710] INFO:  Warning: Failed to download any source lists!
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:16 turtle[2710] INFO:  Warning: Failed to find package build-tools;28.0.3
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:17 turtle[2710] INFO:  Warning: java.net.ConnectException: Connection refused (Connection refused)
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:17 turtle[2710] INFO:  Warning: Failed to download any source lists!
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:17 turtle[2710] INFO:  Warning: Failed to find package extras;android;m2repository
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:18 turtle[2710] INFO:  Warning: java.net.ConnectException: Connection refused (Connection refused)
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:18 turtle[2710] INFO:  Warning: Failed to download any source lists!
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:18 turtle[2710] INFO:  Warning: Failed to find package ndk;17.2.4988734
  platform: "android"
  buildPhase: "setting up environment"
  source: "stderr"
Apr 15 14:23:18 turtle[2710] ERROR: Failed to setup environment for android builds
  err: Error: ./configureAndroidSdk.sh exited with non-zero code: 1
      at ChildProcess.completionListener (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
      at Object.onceWrapper (node:events:476:26)
      at ChildProcess.emit (node:events:369:20)
      at ChildProcess.emit (node:domain:470:12)
      at maybeClose (node:internal/child_process:1067:16)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
      ...
      at spawnAsync (/usr/local/lib/node_modules/turtle-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
      at Object.spawnAsyncThrowError (/@expo/xdl@59.1.0/src/detach/ExponentTools.ts:111:19)
      at _configureSdk (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/sdk.ts:54:23)
      at Object.ensureAndroidSDKIsPresent [as default] (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/sdk.ts:34:7)
      at prepareAndroidEnv (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/index.ts:70:21)
      at Object.setup [as default] (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/android/index.ts:58:3)
      at Object.setup [as default] (/usr/local/lib/node_modules/turtle-cli/src/bin/setup/setup.ts:15:12)
      at setupAction (/usr/local/lib/node_modules/turtle-cli/src/bin/commands/setup.ts:33:5)
      at /usr/local/lib/node_modules/turtle-cli/src/bin/commands/setup.ts:22:40
      at Command. (/usr/local/lib/node_modules/turtle-cli/src/bin/index.ts:23:12)
  platform: "android"