expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
767 stars 81 forks source link

RangeError: Invalid array length on Array(width).join(' ') (@expo/xcpretty) #2333

Open karimhossenbux opened 4 months ago

karimhossenbux commented 4 months ago

Build/Submit details page URL

No response

Summary

running eas build -p ios --local fails:

[RUN_FASTLANE] › Copying   ios/Moonitor/Supporting/Expo.plist ➜ ./Expo.plist
[RUN_FASTLANE] › Compiling Moonitor » SplashScreen.storyboard
[RUN_FASTLANE] › Compiling Moonitor » Moonitor_vers.c
[RUN_FASTLANE] › Compiling Moonitor » main.m
[RUN_FASTLANE] › Linking   Moonitor » Moonitor
[RUN_FASTLANE] ⚠️  ld: ignoring duplicate libraries: '-lc++'
[RUN_FASTLANE] › Preparing Moonitor » Info.plist
[RUN_FASTLANE] › Executing Moonitor » Bundle React Native code and images
/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:811
    return Array(width).join(' ');
           ^

RangeError: Invalid array length
    at fill (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:811:12)
    at formatWarningOrError (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:785:67)
    at ExpoRunFormatter.formatCompileError (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:308:25)
    at MetroParser.formatCompileError (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Parser.js:498:31)
    at MetroParser.parse (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Parser.js:26:25)
    at MetroParser.parse (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/MetroParser.js:18:22)
    at /Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:121:41
    at Array.forEach (<anonymous>)
    at ExpoRunFormatter.pipe (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:120:28)
    at Socket.<anonymous> (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/build-tools/dist/ios/xcpretty.js:60:41)

Node.js v20.11.0
npx exited with non-zero code: 1
    Error: build command failed.

Weird thing is that it work 5 min before, I change the version of the app package.json, and then failed on xcpretty for no reason?

I even tried to revert everything to old version number, no luck.

Running the build on expo works tho, no issue.

Managed or bare?

bare

Environment

expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.2.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.11.0 - ~/.volta/tools/image/node/20.11.0/bin/node
      Yarn: 1.22.22 - ~/.volta/tools/image/yarn/1.22.22/bin/yarn
      npm: 10.2.4 - ~/.volta/tools/image/node/20.11.0/bin/npm
      Watchman: 2024.04.08.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
    IDEs:
      Xcode: 15.3/15E204a - /usr/bin/xcodebuild
    npmPackages:
      expo: ~50.0.15 => 50.0.17 
      expo-router: ~3.4.8 => 3.4.8 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.73.6 => 0.73.6 
      react-native-web: ~0.19.10 => 0.19.10 
    Expo Workflow: bare
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check npm/ yarn versions
✔ Check for issues with metro config
✖ Check for common project setup issues
✔ Check native tooling versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✖ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

This project has native project folders but is also configured to use Prebuild. EAS Build will not sync your native configuration if the ios or android folders are present. Add these folders to your .gitignore file if you intend to use prebuild (aka "managed" workflow).

The following packages should be updated for best compatibility with the installed expo version:
  @react-native-community/datetimepicker@7.6.4 - expected version: 7.6.1
Your project may not work correctly until you install the correct versions of the packages.
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.

One or more checks failed, indicating possible issues with the project.

Error output

[RUN_FASTLANE] › Executing Moonitor » Bundle React Native code and images
/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:811
    return Array(width).join(' ');
           ^

RangeError: Invalid array length
    at fill (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:811:12)
    at formatWarningOrError (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:785:67)
    at ExpoRunFormatter.formatCompileError (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:308:25)
    at MetroParser.formatCompileError (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Parser.js:498:31)
    at MetroParser.parse (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Parser.js:26:25)
    at MetroParser.parse (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/MetroParser.js:18:22)
    at /Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:121:41
    at Array.forEach (<anonymous>)
    at ExpoRunFormatter.pipe (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/xcpretty/build/Formatter.js:120:28)
    at Socket.<anonymous> (/Users/karim/.npm/_npx/89fde002d95f40cb/node_modules/@expo/build-tools/dist/ios/xcpretty.js:60:41)

Node.js v20.11.0
npx exited with non-zero code: 1
- Compressing project files
Error: npx exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/node_modules/@expo/spawn-async/build/spawnAsync.js:41:23)
    at Object.onceWrapper (node:events:633:26)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
    ...
    at spawnAsync (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)
    at runLocalBuildAsync (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/build/build/local.js:43:56)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/build/build/build.js:85:13
    at async startBuildAsync (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/build/build/runBuildAndSubmit.js:280:12)
    at async prepareAndStartBuildAsync (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/build/build/runBuildAndSubmit.js:266:19)
    at async runBuildAndSubmitAsync (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/build/build/runBuildAndSubmit.js:106:49)
    at async Build.runAsync (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/build/commands/build/index.js:42:9)
    at async Build._run (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/node_modules/@oclif/core/lib/command.js:80:22)
    at async Config.runCommand (/Users/karim/.volta/tools/image/packages/eas-cli/lib/node_modules/eas-cli/node_modules/@oclif/core/lib/config/config.js:301:25) {
  pid: 13555,
  output: [ '', '' ],
  stdout: '',
  stderr: '',
  status: 1,
  signal: null
}
- Compressing project files
    Error: build command failed.
- Compressing project files

Reproducible demo or steps to reproduce from a blank project

eas build -p ios --local

szdziedzic commented 4 months ago

which eas-cli version are you using?

karimhossenbux commented 4 months ago

I'm using eas-cli/7.8.2 darwin-arm64 node-v20.11.0, I just did another npm install --global eas-cli, same version. But now it works 🤷‍♂️

Not sure what was the issue, but I'll do more test tonight

smontlouis commented 4 months ago

Having the same issue atm with eas-cli 8.0.0 and node 20 :(. Tried to reinstall but still having the same issue.

@karimhossenbux has it been fixed randomly for you ?