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

NS devices bug | erratic device connection #5717

Open
3 tasks done
EdJones opened this issue Feb 21, 2023 · 2 comments
Open
3 tasks done

NS devices bug | erratic device connection #5717

EdJones opened this issue Feb 21, 2023 · 2 comments
Labels
feature known issue Issue that is known, has a fix or a workaround.

Comments

@EdJones
Copy link

EdJones commented Feb 21, 2023

Issue Description

After connecting iPhone wirelessly to Mac, ns devices results in
Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.

It should consistently identify and run app on remote device.

May be related to #4252

Reproduction

  1. Connect Mac to personal hotspot iPhone
  2. In terminal, run ns devices.

Results are inconsistent. Works sometimes on first try. Sometimes works after terminal restart or reconnection. Sometimes just plain won't cooperate at all.

Relevant log output (if applicable)

edjones@Edwins-MacBook-Air blackliteracymatters % ns devices --log trace      

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*                                                                                                                                               *
*  The "TRACE" log level might print some sensitive data like secrets or access tokens in request URLs. Be careful when you share this output.  *
*                                                                                                                                               *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Trying to get macOS version.
Exec system_profiler SPSoftwareDataType -detailLevel mini 
 stdout: Software:

    System Software Overview:

      System Version: macOS 13.1 (22C65)
      Kernel Version: Darwin 22.2.0
      Time since boot: 3 days, 17 hours, 34 minutes

 
 stderr: 
macOS version based on system_profiler is 13.1.
Looking for project in '/Users/edjones/apps/BlackLiteracyMatters'
Project directory is '/Users/edjones/apps/BlackLiteracyMatters'.
Initializing project identifiers. Config:  {
  id: 'com.edwincjones.blackteenliteracymatters',
  appPath: 'app',
  appResourcesPath: 'App_Resources',
  android: { v8Flags: '--expose_gc', markingMode: 'none' }
}
Loading extensions.
Collecting system information...
System information:
{
  "platform": "darwin",
  "shell": "/bin/zsh",
  "os": "Darwin Edwins-MacBook-Air.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 arm64\n",
  "procArch": "arm64",
  "nodeVer": "18.14.1",
  "npmVer": "9.5.0",
  "nodeGypVer": null,
  "nativeScriptCliVersion": "8.4.0",
  "gitVer": "2.37.1 (Apple Git-137.1)",
  "dotNetVer": null,
  "javacVersion": "15.0.2",
  "javaVersion": "15.0.2",
  "javaPath": "/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home/bin/java",
  "adbVer": "1.0.41",
  "androidInstalled": true,
  "monoVer": null,
  "gradleVer": "7.2",
  "isAndroidSdkConfiguredCorrectly": true,
  "xcodeVer": "14.2.0",
  "xcodeprojLocation": "/OPT/HOMEBREW/opt/[email protected]/bin/xcodeproj",
  "itunesInstalled": false,
  "cocoaPodsVer": "1.11.3",
  "isCocoaPodsWorkingCorrectly": true,
  "isCocoaPodsUpdateRequired": false,
  "pythonInfo": {
    "isInstalled": true,
    "isSixPackageInstalled": true
  }
}
Current CLI version:  8.4.0
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/Users/edjones/apps/BlackLiteracyMatters/hooks' ]
BeforeHookName for command resolveCommand is before-resolveCommand
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/Users/edjones/apps/BlackLiteracyMatters/hooks' ]
AfterHookName for command resolveCommand is after-resolveCommand
Trying to handle SIGINT event. CLI overrides this behavior and does not allow handling SIGINT as this causes issues with Ctrl + C in terminal.
The stackTrace of the location trying to handle SIGINT is:
    at process.on (/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/lib/nativescript-cli.js:26:28)
    at /USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/node_modules/signal-exit/index.js:158:17
    at Array.filter (<anonymous>)
    at load (/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/node_modules/signal-exit/index.js:156:23)
    at module.exports (/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/node_modules/signal-exit/index.js:62:7)
    at Object.<anonymous> (/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/node_modules/proper-lockfile/lib/lockfile.js:331:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
spawn: /Users/edjones/.nvm/versions/node/v18.14.1/bin/node "/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/lib/detached-processes/cleanup-process.js" "/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/lib/bootstrap.js"
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'pageview',
  path: 'devices',
  title: 'devices',
  customDimensions: { cd5: 'CLI', cd2: 'Vue.js', cd9: 'false' }
}
spawn: /Users/edjones/.nvm/versions/node/v18.14.1/bin/node "/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/lib/services/analytics/analytics-broker-process.js" "/USERS/EDJONES/.NVM/VERSIONS/NODE/V18.13.0/lib/node_modules/nativescript/lib/bootstrap.js"
Will send the following information to Google Analytics: {
  type: 'googleAnalyticsData',
  category: 'CLI',
  googleAnalyticsDataType: 'event',
  action: 'Options',
  label: '{"log":"trace","$0":"_localpath","profileDir":"private","bundle":"webpack"}',
  customDimensions: { cd2: 'Vue.js', cd9: 'false', cd5: 'CLI' },
  value: undefined
}

Connected devices & emulators
Searching for devices...
Options for ios-device-discovery {
  platform: undefined,
  shouldReturnImmediateResult: false,
  emulator: false,
  fullDiscovery: true
}
Starting to look for iOS devices.
spawn: /Users/edjones/Library/Android/sdk/platform-tools/adb "start-server"
Result when throw error is false:
{ stdout: '', stderr: '', exitCode: 0 }
spawn: /Users/edjones/Library/Android/sdk/platform-tools/adb "devices"
Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.
IOSDeviceOperations disposed.
edjones@Edwins-MacBook-Air blackliteracymatters % 

Environment

OS: macOS 13.1
CPU: (8) arm64 Apple M1
Shell: /bin/zsh
node: 18.13.0
npm: 9.2.0
nativescript: 8.4.0

android

java: 15.0.2
ndk: Not Found
apis: 29, 30, 31, 33
build_tools: 30.0.3, 31.0.0, 32.0.0
system_images:

  • android-30 | Google APIs ARM 64 v8a
  • android-S | Google APIs ARM 64 v8a

ios

xcode: 14.2/14C18
cocoapods: 1.11.3
python: 2.7.18
python3: 3.9.13
ruby: 2.7.6
platforms:

  • DriverKit 22.2
  • iOS 16.2
  • macOS 13.1
  • tvOS 16.1
  • watchOS 9.1

### Dependencies

```json
"dependencies": {
  "@fortawesome/fontawesome-svg-core": "^6.2.0",
  "@fortawesome/free-regular-svg-icons": "^6.2.0",
  "@fortawesome/free-solid-svg-icons": "^6.2.0",
  "@fortawesome/vue-fontawesome": "^2.0.9",
  "@nativescript/core": "^8.4.7",
  "@nativescript/firebase-auth": "^2.5.1",
  "@nativescript/firebase-core": "^2.5.1",
  "@nativescript/firebase-firestore": "^2.5.1",
  "@nativescript/iqkeyboardmanager": "^2.1.0",
  "@nativescript/social-share": "^2.2.0",
  "@nativescript/tailwind": "^2.0.1",
  "@nativescript/theme": "~3.0.2",
  "@nstudio/nativescript-cardview": "^2.0.1",
  "@triniwiz/nativescript-image-zoom": "^4.1.3",
  "@triniwiz/nativescript-youtubeplayer": "^4.1.4",
  "nativescript-ui-sidedrawer": "^14.2.1",
  "nativescript-vue": "^2.9.3",
  "nativescript-vuex-persistent": "^1.2.0",
  "rxjs": "^7.8.0",
  "tailwindcss": "^3.2.6",
  "vuex": "~3.6.2"
},
"devDependencies": {
  "@nativescript/android": "^8.3.1",
  "@nativescript/ios": "^8.3.3",
  "@nativescript/preview-cli": "1.0.2",
  "@nativescript/webpack": "~5.0.6",
  "nativescript-vue-template-compiler": "~2.9.0"
}

Please accept these terms

@EdJones EdJones added the bug-pending-triage Reported bug, pending triage to confirm. label Feb 21, 2023
@rigor789
Copy link
Member

I believe this is related to timing - wifi devices are sometimes slow to show up as connected - and the CLI has a timeout after which it stops waiting and looking for devices. This is currently set to ~6 seconds after which if no device showed up we report "no devices". Setting the timeout higher would be an option - however the downside to that is it would slow down all build/run commands, as it would now be forced to wait longer initially. Perhaps we can add a config option (or a --timeout flag).

Alternatively with a much bigger refactor, we could daemonize the device lookup task, so we have a background process listening for device changes at all times and the CLI would ping that instead.

@rigor789 rigor789 added feature known issue Issue that is known, has a fix or a workaround. and removed bug-pending-triage Reported bug, pending triage to confirm. labels Apr 18, 2023
@EdJones
Copy link
Author

EdJones commented Apr 18, 2023

I found by chance that my machine had two xcodeproj gems installed. removing one helped a lot with this issue. Still doesn't always find it, but is much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature known issue Issue that is known, has a fix or a workaround.
Projects
None yet
Development

No branches or pull requests

2 participants