question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

run-ios command ignores the verbose option

See original GitHub issue

Environment

info Fetching system and libraries information...
System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 1.47 GB / 16.00 GB
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 10.24.0 - /var/folders/h6/g6rldscd6h389g9w42_7k_jm0swv2d/T/yarn--1617537855315-0.38815081056993295/node
    Yarn: 1.22.10 - /var/folders/h6/g6rldscd6h389g9w42_7k_jm0swv2d/T/yarn--1617537855315-0.38815081056993295/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v10.24.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /Users/liam.jones/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.3, 31.0.0
      System Images: android-21 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1.3 4.1.3
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_282 - /usr/bin/javac
    Python: 3.9.2 - /usr/local/opt/python/libexec/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: 0.63.4 => 0.63.4
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

run-ios detects the presence of xcpretty and uses it if installed. The command-line help for the run-ios command states:

–verbose Do not use xcpretty even if installed

However, when run with the verbose option, xcpretty is still used.

I’ve dug into this a little, it looks like the verbose option is checked for in buildProject(), here: https://github.com/react-native-community/cli/blob/v4.14.0/packages/platform-ios/src/commands/runIOS/index.ts#L307

However, if I debug the command as it’s running, verbose is undefined.

The issue seems to be coming from Command.prototype.opts() inside commander. Here it copies the values from properties on this (the Command) into result[key]: https://github.com/tj/commander.js/blob/v2.20.3/index.js#L779. This works for other options like packager (set via --no-packager). I can see packager, etc exist on this for the working properties but for some reason this.verbose doesn’t.

I’ve not been able to work out why this happens yet (nor if it’s a problem in the cli or commander).

I’ve also created a fresh RN 0.64.0 project to check the behaviour is the same (and it is).

Reproducible Demo

  1. Install xcpretty
  2. Create RN project
  3. Run run-ios and note xcpretty formatted output
  4. Run run-ios --verbose and note xcpretty formatted output is still present

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
liamjonescommented, Nov 28, 2022

Still waiting on PR #1571 to be approved and merged to fix this.

1reaction
grabboucommented, Jul 19, 2021

I would imagine we can pass commander.verbose https://github.com/react-native-community/cli/blob/641b21f583c97e3d48ce87d5fe804f42db92fa5c/packages/cli/src/index.ts#L28-L30 to here https://github.com/react-native-community/cli/blob/641b21f583c97e3d48ce87d5fe804f42db92fa5c/packages/cli/src/index.ts#L138

{...passedOptions, verbose: commander.verbose()}

We have tried upgrading to a newer version, but that was quite a challenge. I would say for now, the easiest workaround is to pass it this way, or provide a utility function isVerboseMode() that would check process.argv itself, like the init workaround you have linked.

Either way, I’d be happy to accept this as a PR!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find iPhone X simulator. Run CLI with --verbose flag ...
One way to solve this is by making changes in the node_modules folder. Steps below. Go to node_modules/@react-native-community/cli/build/ ...
Read more >
Add verbose logging to all commands · Issue #96 - GitHub
Add --verbose flag to enable DEBUG log level. Logger unification and implementation is tracked in #95.
Read more >
Cordova Command-line-interface (CLI) Reference
This option should be used with caution as it ignores the conflict detection and will overwrite all conflicts it has with other plugins,...
Read more >
GNU tar 1.34: The --verbose Option
Each instance of ' --verbose ' on the command line increases the verbosity level by one, so if you need more details on...
Read more >
@nrwl/workspace:run-commands | Nx
@nrwl/workspace:run-commands. Run any custom commands with Nx. Options can be configured in project.json when defining the executor, or when invoking it.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found