Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: Command PhaseScriptExecution failed with a nonzero exit code when running from Xcode #300

Open
1 task done
AhmedLSayed9 opened this issue May 20, 2024 · 11 comments
Labels
bug Something isn't working keep open Needs Attention OP created or responded to issue and it needs attention. question Further information is requested

Comments

@AhmedLSayed9
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues.

CLI Version

1.0.1-dev.0

Firebase Tools version

13.8.1

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.19.6, on macOS 14.5 23F79 darwin-arm64, locale en-EG)
• Flutter version 3.19.6 on channel stable at /Users/bx777/.puro/envs/stable/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9 (5 weeks ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/bx777/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.89.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.88.0

[✓] Connected device (4 available)
• Ahmed’s iPhone (mobile) • 00008020-00155D412243002E • ios • iOS 17.4.1 21E236
• iPhone 15 Pro Max (mobile) • 1B9F51D0-2C93-4450-B83A-EEC3AF400616 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.209

[✓] Network resources
• All expected network resources are available.

• No issues found!

Description

When running a flutter project with flavor from VSCode or command line it works fine.

But, when running from Xcode I get an error Command PhaseScriptExecution failed with a nonzero exit code,

Using the Xcode report navigator, it shows the cause of the error is:

/Users/bx777/Library/Developer/Xcode/DerivedData/Runner-efucnxnpxngwpuawulskwwbebelt/Build/Intermediates.noindex/Runner.build/Debug-dev-iphonesimulator/Runner.build/Script-53713B544D4D72BE6CC51AC1.sh: line 5: flutterfire: command not found

Steps to reproduce

  1. Run a project with flavor using the following command:
flutter build ios --debug --flavor=dev --target=lib/main_dev.dart --dart-define-from-file=configs/dev.json
  1. It works find and run as expected
  2. Run again after the previous build success but using Xcode build this time
  3. The build fails and gives an error

Expected behavior

I expect it to run normally using Xcode build after a normal flutter build ios command "which generates and pass dart environment variables into Xcode build".

Screenshots

Screenshot 2024-05-20 at 8 38 40 PM

Additional context and comments

No response

@AhmedLSayed9 AhmedLSayed9 added bug Something isn't working triage labels May 20, 2024
@russellwheatley
Copy link
Member

@AhmedLSayed9

I've just ran this on Xcode and it was successful:
Screenshot 2024-05-22 at 11 41 54

The exception is saying that it cannot find flutterfire. This seems like a problem with where flutterfire is located. Before we call flutterfire, we add this to the Xcode PATH variable:

PATH="${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin"

flutterfire executable on my machine is located here: $HOME/.pub-cache/bin. Where is it located on your machine?

@russellwheatley russellwheatley added question Further information is requested and removed triage labels May 22, 2024
@AhmedLSayed9
Copy link
Contributor Author

flutterfire

I'm using puro for version management so mine is located at $HOME/.puro/shared/pub_cache/bin/flutterfire

@russellwheatley
Copy link
Member

That will be why it doesn't work then. Is there any way you can move it to the standard path?

@AhmedLSayed9
Copy link
Contributor Author

That will be why it doesn't work then. Is there any way you can move it to the standard path?

I don't think that is possible when using puro.

I've found an open issue regarding this at pingbird/puro#70.
The puro's author suggests flutterfire to follow the semantics of the pub tool and use PUB_CACHE

@russellwheatley
Copy link
Member

If you could explain what that means it would be helpful. As far as I can tell, we're using the default path.

@AhmedLSayed9
Copy link
Contributor Author

If you could explain what that means it would be helpful. As far as I can tell, we're using the default path.

I think he's referring to update the path in the script to the following:

PATH="${PATH}:$FLUTTER_ROOT/bin:$PUB_CACHE/bin"

PUB_CACHE seems to accurately retrieve the path where the "pub_cache" directory and "flutterfire" are located:

Screenshot 2024-05-23 at 7 35 09 PM

@russellwheatley
Copy link
Member

That's fair enough, I'm happy to make that change👍

@russellwheatley
Copy link
Member

edit: I will have to check now that I think about it, I'm not sure that will be available in the Xcode build environment variables.

Copy link

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot added the Stale label Sep 30, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 15, 2024
@AhmedLSayed9
Copy link
Contributor Author

@russellwheatley Is there any update on this?

@github-actions github-actions bot added the Needs Attention OP created or responded to issue and it needs attention. label Dec 1, 2024
@salarazad
Copy link

salarazad commented Dec 17, 2024

Please check this answer on Stackoverflow, it solved the issue for me:
https://stackoverflow.com/a/79288298/6243913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keep open Needs Attention OP created or responded to issue and it needs attention. question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants