appium / appium/java-client

Unable to start service using AppiumDriverLocalService.buildService(builder)

Open
#1,924 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description

Unable to start appium server programmatically, using AppiumDriverLocalService. I'm able to start appium via commandline.

Environment

APPIUM JAVA CLIENT : 8.5.0
APPIUM SERVER : 2.0.0-beta.71
NODE : v20.2.0
NPM : v9.6.6
OS : macOS Monterey (V 2.6.5 (21G531))
Chip : Apple M1 Pro

Code To Reproduce Issue

AppiumDriverLocalService service;
		AppiumServiceBuilder builder = new AppiumServiceBuilder();
		builder.withIPAddress(CommonUtil.getLocalIPAddress());
		builder.usingAnyFreePort();
//		builder.usingDriverExecutable(new File("/usr/local/bin/node"));
		builder.withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js"));
//		builder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
//		builder.withArgument(() -> GeneralServerFlag.BASEPATH.getArgument(), "/wd/hub");
                service = AppiumDriverLocalService.buildService(builder);
                service.start();

Exception

/usr/local/lib/node_modules/appium/node_modules/sharp/lib/sharp.js:37
  throw new Error(help.join('\n'));
        ^
Error: 
Something went wrong installing the "sharp" module

dlopen(/usr/local/lib/node_modules/appium/node_modules/sharp/build/Release/sharp-darwin-x64.node, 0x0001): symbol not found in flat namespace (__ZTVN4vips7VOptionE)

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current darwin-x64 runtime: "npm install --platform=darwin --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/sharp/lib/sharp.js:37:9)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/sharp/lib/constructor.js:11:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/sharp/lib/index.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
Exception in thread "main" io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: /usr/local/bin/node Arguments: [/usr/local/lib/node_modules/appium/build/lib/main.js, --port, 4723, --address, 0.0.0.0] 
Process output: 
/usr/local/lib/node_modules/appium/node_modules/sharp/lib/sharp.js:37
  throw new Error(help.join('\n'));
        ^
Error: 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied AppiumDriverLocalService/AppiumServiceBuilder snippet and reproduce the failure on the listed macOS, Node, Appium, and Java Client versions. Investigate the reported sharp module loading error and the resulting AppiumServerHasNotBeenStartedLocallyException. Done means the service starts successfully through the Java client rather than only from the command line.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, macos, node.js
Domain
mobile-dev, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.