Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

bug: Can't start Appium server through code - getting 'npm' executable is not found when even though npm is there

未关闭
#2,037 16 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java

调研方向

使用提供的 macOS 路径从 AppiumServiceBuilder 和 AppiumDriverLocalService 开始,重点关注启动前如何解析 npm 可执行文件和 PATH。使用最小示例重现该故障,并验证本地 Appium 服务器是否成功启动且在 127.0.0.1:4723/status 响应。

由索引模型根据 Issue 内容生成。

描述

bug
Do I have the most recent component updates?
  • I use the most recent available driver/plugin and server versions
Is the component officially supported by the Appium team?
  • I have verified the component repository is present under the Appium organization in GitHub
Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

I wanted to upgrade from Appium 1.x to Appium 2.x+ but have been facing an issue when trying to run the appium server from the code. I get this error before it times out: [Appium] 'npm' executable is not found neither in the process working folder (/Users/[user]/Projects/povio-automated-qa) nor in any folders specified in the PATH environment variable (/usr/bin:/bin:/usr/sbin:/sbin). After Timeout I get this:

[The local appium server has not been started, Reason: Timed out waiting for [http://127.0.0.1:4723/status] to be available 
after 20003 ms, Consider increasing the server startup timeout value (currently 20000ms), Node.js executable path: 
/usr/local/bin/node, Arguments: [/opt/homebrew/bin/appium, --port, 4723, --address, 127.0.0.1, --log, 
/Users/[user]/Projects/povio-automated-qa/target/resources/appium_server_logs1, --session-override], Output: [Appium] 
'npm' executable is not found neither in the process working folder (/Users/mmeholli/Projects/povio-automated-qa) nor in any 
folders specified in the PATH environment variable (/usr/bin:/bin:/usr/sbin:/sbin)
]

I have tried increasing the timeout, upgrading and downgrading appium, selenium, java, node, and have checked environmental variables for any potential fix, but nothing works.

This is the current code that I'm working with:

AppiumServiceBuilder appiumServiceBuilder = new AppiumServiceBuilder();
        appiumServiceBuilder.usingPort(PORT)
                .withIPAddress("127.0.0.1")
                .withAppiumJS(new File("/opt/homebrew/bin/appium"))
                .usingDriverExecutable(new File("/usr/local/bin/npm"))
                .withArgument(GeneralServerFlag.SESSION_OVERRIDE)
                .withLogFile(new File(System.getProperty("user.dir") + "/target/resources/appium_server_logs" + Thread.currentThread().getId()));
        service = AppiumDriverLocalService.buildService(appiumServiceBuilder);
        service.start();

I am using:
Appium 2.0.1
java-client 8.6.0
Selenium 4.9.1

Expected Behavior

I am expecting the appium server to start from the code

Minimal Reproducible Example
AppiumServiceBuilder appiumServiceBuilder = new AppiumServiceBuilder();
        appiumServiceBuilder.usingPort(PORT)
                .withIPAddress("127.0.0.1")
                .withAppiumJS(new File("/opt/homebrew/bin/appium"))
                .usingDriverExecutable(new File("/usr/local/bin/npm"))
                .withArgument(GeneralServerFlag.SESSION_OVERRIDE)
                .withLogFile(new File(System.getProperty("user.dir") + "/target/resources/appium_server_logs" + Thread.currentThread().getId()));
        service = AppiumDriverLocalService.buildService(appiumServiceBuilder);
        service.start();
Environment
Link to Appium Logs

No response

Further Information

No response

主要语言
Java
星标
1.3k
派生
755
平均合并
5 天 14 小时
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

appium/java-client 的其他 Issue

查看 appium/java-client 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。