Skip to content

Conversation

@KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Oct 19, 2025

Run appium driver run xcuitest download-wda-sim  --platform=ios --outdir=/Users/runner/work/python-client/python-client/wda
node:internal/modules/package_json_reader:266
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'appium' imported from /Users/runner/.appium/node_modules/appium-xcuitest-driver/scripts/download-wda-sim.mjs
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:266:9)
    at packageResolve (node:internal/modules/esm/resolve:767:81)
    at moduleResolve (node:internal/modules/esm/resolve:853:18)
    at defaultResolve (node:internal/modules/esm/resolve:983:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:731:20)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:310:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:183:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.20.0

https://github.com/appium/python-client/actions/runs/18627636752/job/53107861784 but, for example https://github.com/appium/java-client/actions/runs/18460537702/job/52590775529 worked. (both had newer than appium/appium-xcuitest-driver#2637 change)

I wondered what was wrong with this GitHub Actions. Current way is installing appium related things via run though. Some deps might be weird?

https://github.com/appium/ruby_lib_core/actions/runs/18627784681/job/53108204968 is also had the same error.

@mykola-mokhnach
Copy link
Contributor

@KazuCocoa maybe try the same workaround as in appium/appium#21636 ?

@KazuCocoa
Copy link
Member Author

Could be, but then this means we may need to put the workaround in our troubleshooting documentation since this behavior possibly widely occur

@KazuCocoa
Copy link
Member Author

Ok, I see the reason. The "symlink" to the global appium module keeps only for latest installed driver/plugin.

e.g. install xcuitest first, then uia2. Then, symlink to appium in xcuitest driver was gone.

kazu $ appium driver install xcuitest
✔ Checking if 'appium-xcuitest-driver' is compatible
✔ Installing 'xcuitest'
ℹ Driver xcuitest@10.2.2 successfully installed
- automationName: XCUITest
- platformNames: ["iOS","tvOS"]
kazu $ ls -all ~/.appium/node_modules/appium-xcuitest-driver/node_modules | grep 'appium'
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 @appium
lrwxr-xr-x@   1 kazu  staff     63 Oct 19 10:24 appium -> /Users/kazu/.nvm/versions/node/v22.18.0/lib/node_modules/appium
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-idb
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-ios-device
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-ios-remotexpc
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-ios-simulator
drwxr-xr-x@  11 kazu  staff    352 Oct 19 10:24 appium-ios-tuntap
drwxr-xr-x@  11 kazu  staff    352 Oct 19 10:24 appium-remote-debugger
drwxr-xr-x@  16 kazu  staff    512 Oct 19 10:24 appium-webdriveragent
drwxr-xr-x@   8 kazu  staff    256 Oct 19 10:24 appium-xcode
kazu $ appium driver install uiautomator2
✔ Checking if 'appium-uiautomator2-driver' is compatible
✔ Installing 'uiautomator2'
ℹ Driver uiautomator2@5.0.5 successfully installed
- automationName: UiAutomator2
- platformNames: ["Android"]
kazu $ ls -all ~/.appium/node_modules/appium-xcuitest-driver/node_modules | grep 'appium'
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 @appium
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-idb
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-ios-device
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-ios-remotexpc
drwxr-xr-x@   9 kazu  staff    288 Oct 19 10:24 appium-ios-simulator
drwxr-xr-x@  11 kazu  staff    352 Oct 19 10:24 appium-ios-tuntap
drwxr-xr-x@  11 kazu  staff    352 Oct 19 10:24 appium-remote-debugger
drwxr-xr-x@  16 kazu  staff    512 Oct 19 10:24 appium-webdriveragent
drwxr-xr-x@   8 kazu  staff    256 Oct 19 10:24 appium-xcode
kazu $ ls -all ~/.appium/node_modules/appium-uiautomator2-driver | grep 'appium'
kazu $ ls -all ~/.appium/node_modules/appium-uiautomator2-driver/node_modules | grep 'appium'
drwxr-xr-x@   8 kazu  staff    256 Oct 19 10:24 @appium
lrwxr-xr-x@   1 kazu  staff     63 Oct 19 10:24 appium -> /Users/kazu/.nvm/versions/node/v22.18.0/lib/node_modules/appium
drwxr-xr-x@  10 kazu  staff    320 Oct 19 10:24 appium-adb
drwxr-xr-x@   8 kazu  staff    256 Oct 19 10:24 appium-android-driver
drwxr-xr-x@  10 kazu  staff    320 Oct 19 10:24 appium-chromedriver
drwxr-xr-x@   8 kazu  staff    256 Oct 19 10:24 appium-uiautomator2-server
drwxr-xr-x@  10 kazu  staff    320 Oct 19 10:24 io.appium.settings

# then...
kazu $ appium driver run xcuitest download-wda-sim  --platform=ios --outdir=/Users/kazu/tmp/b/wda
node:internal/modules/package_json_reader:255
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'appium' imported from /Users/kazu/.appium/node_modules/appium-xcuitest-driver/scripts/download-wda-sim.mjs
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
    at packageResolve (node:internal/modules/esm/resolve:767:81)
    at moduleResolve (node:internal/modules/esm/resolve:853:18)
    at defaultResolve (node:internal/modules/esm/resolve:983:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:783:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:707:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:690:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:183:49) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v22.18.0
Error: ✖ Encountered an error when running 'download-wda-sim': Script exited with code 1

So, if the environment installs xcuitest driver as "last" installed appium module, it should not have this import error.

cc @mykola-mokhnach

I haven't read Appium code. I'll take a look tonight

@KazuCocoa
Copy link
Member Author

(I expected the symlink to be kept for each node_modules)

@mykola-mokhnach
Copy link
Contributor

Thanks for checking it @KazuCocoa

This looks really weird to me, perhaps some npm wizardry happens that we don't understand?

The code to create symlink is located in https://github.com/appium/appium/blob/d12a6a53cf06a30b450c67b829efde15b2f89ee1/packages/appium/lib/cli/extension-command.js#L459

@mykola-mokhnach
Copy link
Contributor

I've created appium/appium#21664
Could you please check if that patch solves the problem?

@KazuCocoa KazuCocoa closed this Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants