bug: Can't start Appium server through code - getting 'npm' executable is not found when even though npm is there
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
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
- Operating system: Mac OS Ventura 13.3.1
- Appium server version (output of
appium --version): 2.0.1 - Appium driver(s) and their version(s):
- uiautomator2@2.29.2 [installed (npm)]
- xcuitest@4.32.21 [installed (npm)]
- espresso@2.24.0 [installed (npm)]
- safari@3.4.0 [installed (npm)]
- gecko@1.1.10 [installed (npm)]
- Appium plugin(s) and their version(s):
- images@2.1.2 [installed (npm)]
- execute-driver@3.0.14 [installed (npm)]
- gestures@3.0.0 [installed (npm)]
- Node.js version (output of
node --version): v20.8.0 npmversion (output ofnpm --version): 10.1.0- Last component(s) version which did not exhibit the problem:
- Platform and version under test:
- Real device or emulator/simulator:
Link to Appium Logs
No response
Further Information
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with AppiumServiceBuilder and AppiumDriverLocalService using the provided macOS paths, focusing on how the npm executable and PATH are resolved before startup. Reproduce the failure with the minimal example and verify that the local Appium server starts successfully and responds at 127.0.0.1:4723/status.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile-dev, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100