AppiumTestDistribution / appium-device-farm

This is an Appium 2.0 plugin designed to manage and create driver sessions on available devices.
https://devicefarm.org
Other
335 stars 102 forks source link

Can't start device-farm for iOS #713

Closed tking16 closed 1 year ago

tking16 commented 1 year ago

Starting Appium device farm when setting platform to ios will fail to execute, giving: Could not configure Appium server. It's possible that a driver or plugin tried to update the server and failed. Original error: ENOENT: no such file or directory, scandir '/Users/theo.king/code/testing/app-at/node_modules/appium-device-farm/node_modules/go-ios/dist/'

logs

https://gist.github.com/tking16/70e6943c22af5f9e555105298259b0bf

Environment

Minimal Reproducible Example

https://github.com/tking16/SampleProj-deviceFarm

outi5 commented 1 year ago

@tking16, I had this problem last week and I think I found that the .../go-ios directory was missing, so I added it to that path and then reran npm install. I'm not 100% sure that's what fixed it, but know it had something to do with that directory missing. If I run into it again, I'll update here.

tking16 commented 1 year ago

Yeah the go-ios folder is definitely there, I even ran npm install go-ios still no luck

saikrishna321 commented 1 year ago

@tking16 What is in this folder /xxx//app-at/node_modules/appium-device-farm/node_modules/go-ios/dist/

saikrishna321 commented 1 year ago

@tking16 Can you try with latest version if the existing go-ios failed to fetch we look for globally. So you can install npm install -g go-ios

tking16 commented 1 year ago

Thanks @saikrishna321, getting a new error now:

2023-04-28 10:05:46:963 - [debug] [ADB] Running '/Users/theo.king/Library/Android/sdk/platform-tools/adb -P 5037 -s R3CT40962TF shell getprop ro.build.version.release'
2023-04-28 10:05:46:964 - [debug] [ADB] Running '/Users/theo.king/Library/Android/sdk/platform-tools/adb -P 5037 -s R3CT40962TF shell getprop ro.build.characteristics'
2023-04-28 10:05:46:964 - [debug] [ADB] Running '/Users/theo.king/Library/Android/sdk/platform-tools/adb -P 5037 -s R3CT40962TF shell dumpsys bluetooth_manager | grep name: | cut -c9-'
2023-04-28 10:05:47:312 - [device-farm] Had trouble finding go-ios within device-farm modules, checking globally
2023-04-28 10:05:47:535 - [Appium] Could not configure Appium server. It's possible that a driver or plugin tried to update the server and failed. Original error: Command 'npm bin -g' exited with code 1
2023-04-28 10:05:47:535 - [debug] [Appium] Error: Command 'npm bin -g' exited with code 1
2023-04-28 10:05:47:535 - [debug] [Appium]     at ChildProcess.<anonymous> (/Users/theo.king/code/xxx/testing/app-at/node_modules/teen_process/lib/exec.js:129:19)
2023-04-28 10:05:47:535 - [debug] [Appium]     at ChildProcess.emit (node:events:512:28)
2023-04-28 10:05:47:535 - [debug] [Appium]     at maybeClose (node:internal/child_process:1098:16)
2023-04-28 10:05:47:535 - [debug] [Appium]     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
make: *** [appium] Error 1

This occurs both before and after running npm install -g go-ios

tking16 commented 1 year ago

@tking16 What is in this folder /xxx//app-at/node_modules/appium-device-farm/node_modules/go-ios/dist/

go-ios/ ┣ bin/ ┣ dist/ ┃ ┣ go-ios-darwin-amd64_darwin_amd64/ ┃ ┃ ┗ ios ┃ ┣ go-ios-linux-amd64_linux_amd64/ ┃ ┃ ┗ ios ┃ ┗ go-ios-windows-amd64_windows_amd64/ ┃ ┗ ios.exe ┣ package.json ┗ postinstall.js

Btw I'm using an M1 Mac if that makes any difference

saikrishna321 commented 1 year ago

@tking16 when you the command in your terminal what is the output npm bin -g

saikrishna321 commented 1 year ago

@tking16 What is in this folder /xxx//app-at/node_modules/appium-device-farm/node_modules/go-ios/dist/

go-ios/ ┣ bin/ ┣ dist/ ┃ ┣ go-ios-darwin-amd64_darwin_amd64/ ┃ ┃ ┗ ios ┃ ┣ go-ios-linux-amd64_linux_amd64/ ┃ ┃ ┗ ios ┃ ┗ go-ios-windows-amd64_windows_amd64/ ┃ ┗ ios.exe ┣ package.json ┗ postinstall.js

Btw I'm using an M1 Mac if that makes any difference

Expected output. Not sure why it says /xxx//app-at/node_modules/appium-device-farm/node_modules/go-ios/dist/ not present. Let me check

saikrishna321 commented 1 year ago

@tking16 I tried from your project with the latest appium-device-farm and I can't reproduce your problem

❯ make appium
node ./node_modules/appium/build/lib/main.js --log-timestamp --allow-insecure=get_server_logs -pa /wd/hub --use-plugins=device-farm --plugin-device-farm-platform=both -p 4724
2023-04-29 05:10:03:721 - [Appium] Attempting to load plugin device-farm...
2023-04-29 05:10:03:722 - [debug] [Appium] Requiring plugin at /Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-device-farm
2023-04-29 05:10:03:986 - [Appium] Welcome to Appium v2.0.0-beta.66 (REV 66f494b845b0a5cb9066c3e8fdc68cf84e6b720d)
2023-04-29 05:10:03:987 - [Appium] Non-default server args:
2023-04-29 05:10:03:988 - [Appium] {
2023-04-29 05:10:03:988 - [Appium]   allowInsecure: [
2023-04-29 05:10:03:988 - [Appium]     'get_server_logs'
2023-04-29 05:10:03:988 - [Appium]   ],
2023-04-29 05:10:03:988 - [Appium]   basePath: '/wd/hub',
2023-04-29 05:10:03:989 - [Appium]   logTimestamp: true,
2023-04-29 05:10:03:989 - [Appium]   port: 4724,
2023-04-29 05:10:03:989 - [Appium]   usePlugins: [
2023-04-29 05:10:03:989 - [Appium]     'device-farm'
2023-04-29 05:10:03:989 - [Appium]   ]
2023-04-29 05:10:03:989 - [Appium] }
2023-04-29 05:10:03:989 - [Appium] Attempting to load driver xcuitest...
2023-04-29 05:10:03:990 - [debug] [Appium] Requiring driver at /Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-xcuitest-driver
2023-04-29 05:10:04:491 - [Appium] Attempting to load driver uiautomator2...
2023-04-29 05:10:04:492 - [debug] [Appium] Requiring driver at /Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-uiautomator2-driver
reusing global emitter
2023-04-29 05:10:04:935 - [device-farm] 📣📣📣 Device Farm Plugin will be served at 🔗 http://localhost:4724/device-farm
2023-04-29 05:10:04:938 - [ADB] Found 3 'build-tools' folders under '/Users/saikrishna/Library/Android/sdk' (newest first):
2023-04-29 05:10:04:938 - [ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/33.0.0
2023-04-29 05:10:04:938 - [ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/30.0.3
2023-04-29 05:10:04:938 - [ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/30.0.2
2023-04-29 05:10:04:939 - [ADB] Using 'adb' from '/Users/saikrishna/Library/Android/sdk/platform-tools/adb'
2023-04-29 05:10:04:939 - [debug] [ADB] Running '/Users/saikrishna/Library/Android/sdk/platform-tools/adb -P 5037 start-server'
2023-04-29 05:10:04:953 - [debug] [ADB] Getting connected devices
2023-04-29 05:10:04:969 - [debug] [ADB] No connected devices have been detected
2023-04-29 05:10:04:978 - [device-farm] Had trouble finding go-ios within device-farm modules, checking globally
2023-04-29 05:10:05:174 - [Appium] Could not configure Appium server. It's possible that a driver or plugin tried to update the server and failed. Original error: Failed to find go-ios, please install globally npm install -g go-ios
2023-04-29 05:10:05:174 - [debug] [Appium] Error: Failed to find go-ios, please install globally npm install -g go-ios
2023-04-29 05:10:05:174 - [debug] [Appium]     at GoIosTracker.<anonymous> (/Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-device-farm/lib/device-managers/iOSTracker.js:50:27)
2023-04-29 05:10:05:174 - [debug] [Appium]     at Generator.next (<anonymous>)
2023-04-29 05:10:05:174 - [debug] [Appium]     at fulfilled (/Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-device-farm/lib/device-managers/iOSTracker.js:5:58)

Once I install go-ios globally I can get the server started without any issues.

make appium
node ./node_modules/appium/build/lib/main.js --log-timestamp --allow-insecure=get_server_logs -pa /wd/hub --use-plugins=device-farm --plugin-device-farm-platform=both -p 4724
2023-04-29 09:46:58:065 - [Appium] Attempting to load plugin device-farm...
2023-04-29 09:46:58:066 - [debug] [Appium] Requiring plugin at /Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-device-farm
2023-04-29 09:46:58:248 - [Appium] Welcome to Appium v2.0.0-beta.66 (REV 66f494b845b0a5cb9066c3e8fdc68cf84e6b720d)
2023-04-29 09:46:58:249 - [Appium] Non-default server args:
2023-04-29 09:46:58:250 - [Appium] {
2023-04-29 09:46:58:250 - [Appium]   allowInsecure: [
2023-04-29 09:46:58:250 - [Appium]     'get_server_logs'
2023-04-29 09:46:58:250 - [Appium]   ],
2023-04-29 09:46:58:250 - [Appium]   basePath: '/wd/hub',
2023-04-29 09:46:58:250 - [Appium]   logTimestamp: true,
2023-04-29 09:46:58:250 - [Appium]   port: 4724,
2023-04-29 09:46:58:251 - [Appium]   usePlugins: [
2023-04-29 09:46:58:251 - [Appium]     'device-farm'
2023-04-29 09:46:58:251 - [Appium]   ]
2023-04-29 09:46:58:251 - [Appium] }
2023-04-29 09:46:58:251 - [Appium] Attempting to load driver xcuitest...
2023-04-29 09:46:58:251 - [debug] [Appium] Requiring driver at /Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-xcuitest-driver
2023-04-29 09:46:58:577 - [Appium] Attempting to load driver uiautomator2...
2023-04-29 09:46:58:577 - [debug] [Appium] Requiring driver at /Users/saikrishna/Downloads/git/device-farm-demo/issue/SampleProj-deviceFarm/node_modules/appium-uiautomator2-driver
reusing global emitter
2023-04-29 09:46:58:868 - [device-farm] 📣📣📣 Device Farm Plugin will be served at 🔗 http://localhost:4724/device-farm
2023-04-29 09:46:58:872 - [ADB] Found 3 'build-tools' folders under '/Users/saikrishna/Library/Android/sdk' (newest first):
2023-04-29 09:46:58:872 - [ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/33.0.0
2023-04-29 09:46:58:872 - [ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/30.0.3
2023-04-29 09:46:58:872 - [ADB]     /Users/saikrishna/Library/Android/sdk/build-tools/30.0.2
2023-04-29 09:46:58:872 - [ADB] Using 'adb' from '/Users/saikrishna/Library/Android/sdk/platform-tools/adb'
2023-04-29 09:46:58:872 - [debug] [ADB] Running '/Users/saikrishna/Library/Android/sdk/platform-tools/adb -P 5037 start-server'
2023-04-29 09:46:58:887 - [debug] [ADB] Getting connected devices
2023-04-29 09:46:58:904 - [debug] [ADB] No connected devices have been detected
2023-04-29 09:46:58:912 - [device-farm] Had trouble finding go-ios within device-farm modules, checking globally
2023-04-29 09:46:59:111 - [device-farm] Found go-ios globally!
No tvOS simulators found!
2023-04-29 09:46:59:221 - [Appium] Appium REST http interface listener started on 0.0.0.0:4724/wd/hub
2023-04-29 09:46:59:221 - [Appium] Available drivers:
2023-04-29 09:46:59:221 - [Appium]   - xcuitest@4.25.0 (automationName 'XCUITest')
2023-04-29 09:46:59:221 - [Appium]   - uiautomator2@2.22.1 (automationName 'UiAutomator2')
2023-04-29 09:46:59:221 - [Appium] Available plugins:
2023-04-29 09:46:59:221 - [Appium]   - device-farm@5.7.0 (ACTIVE)
2023-04-29 09:46:59:221 - [Appium]   - appium-dashboard@v2.0.2
tking16 commented 1 year ago

@tking16 when you the command in your terminal what is the output npm bin -g

Unknown command: "bin"

tking16 commented 1 year ago

@saikrishna321 since npm bin doesn't work for me, do I need to be on a certain version? I'm on 9.3.1, can't see any info on npm bin, tried installing this package but it looks like it's no longer supported, doesn't solve my issue either

saikrishna321 commented 1 year ago

@tking16 Made some improvements. Please use latest and also refer readMe

WolfmosRioja commented 1 year ago

I have the same problem with go-ios. Could you help me? Captura de pantalla 2023-05-18 a las 11 45 37 Captura de pantalla 2023-05-18 a las 11 49 38

thanks

outi5 commented 1 year ago

@WolfmosRioja, I've been getting an error around the go-iOS package when trying to run device-farm 7.4, but downgrading to 7.2 works for me. I suspect this is something different from what @tking16 is experiencing, though, since his issues were initially reported on 7.2. So I'm not sure if that will help you or not, but might be worth a try.

saikrishna321 commented 1 year ago

@outi5 what is the error ur facing ?

@WolfmosRioja your GO_IOS env should have /ios

outi5 commented 1 year ago

@saikrishna321 here's what I'm getting:

Error: Command '/Users/{ USER NAME }/.cache/appium-device-farm/goIOS/ios' not found. Is it installed?
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

Here's the entire log: https://gist.github.com/outi5/3abf4e9861e28b322dfd6526ee4d4032

saikrishna321 commented 1 year ago

@outi5 Did u run the install-go-ios script?

saikrishna321 commented 1 year ago

Users/{ USER NAME }/.cache/appium-device-farm/goIOS/ios'

Is this path present in your machine ?

outi5 commented 1 year ago

Yes, that's the path, but it's not present on my machine. The path is incomplete. the subdirectories /goIOS/ios do not exist.

WolfmosRioja commented 1 year ago

I have found the solution (thanks @saikrishna321 ) I have set this. I think this solution should be added to the instructions... export GO_IOS="/usr/local/lib/node_modules/go-ios/dist/go-ios-darwin-amd64_darwin_amd64/iOS"

thanks a lot! it's working now

WolfmosRioja commented 1 year ago

@outi5 , I have installed with npm install -g go-ios and I have added the route in my PATH (check the previous comment)

tking16 commented 1 year ago

Thanks, appium plugin device-farm install-go-ios sorted it for me! On an unrelated note, @saikrishna321 is there an alternative for appium-dashboard? As it seems to be broken for me (due to this)

saikrishna321 commented 1 year ago

@WolfmosRioja I have set this. I think this solution should be added to the instructions Happy to merge PR. Would you want to raise a PR?

WolfmosRioja commented 1 year ago

@WolfmosRioja I have set this. I think this solution should be added to the instructions Happy to merge PR. Would you want to raise a PR?

https://github.com/AppiumTestDistribution/appium-device-farm/pull/724. done 😉

saikrishna321 commented 1 year ago

@WolfmosRioja Have left small review

outi5 commented 1 year ago

I have found the solution (thanks @saikrishna321 ) I have set this. I think this solution should be added to the instructions... export GO_IOS="/usr/local/lib/node_modules/go-ios/dist/go-ios-darwin-amd64_darwin_amd64/iOS"

thanks a lot! it's working now

Thanks, @WolfmosRioja! This worked for me. I had installed node via brew, so my path was to /opt/homebrew/lib/node_modules/go-ios/dist/go-ios-darwin-amd64_darwin_amd64/ios, but that's the only change I made and it worked beautifully.