Open mergimmeholli opened 10 months ago
Even I am facing the same error when trying to start the appium server automatically
[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)
did you check whether npm is in any of those places?
@jlipps I am also experiencing the same issue, I was able to programatically launch the appium server yesterday but today all of a sudden it has stopped working.
In reply to your question, it appears that appium is only looking at a part of my environmental variable paths for the executable file. I get the following error message:
(/Users/username/dev/automation-appium) nor in any folders specified in the PATH environment variable (/usr/local/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin)
When I echo $PATH
/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/Caskroom/miniconda/base/bin:/opt/homebrew/bin/node:/opt/homebrew/bin/npm:/opt/apache-maven-3.8.6/bin:/opt/homebrew/opt/m4/bin:/Users/username/Library/Android/sdk/tools/bin:/Users/username/Library/Android/sdk/platform-tools:/Users/username/Library/Android/sdk/tools/bin:/Users/username/Library/Android/sdk/emulator:/Users/username/Library/Android/sdk/tools:/opt/homebrew/opt/openjdk@11/bin:/usr/local/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/username/Library/Android/sdk/bundle-tool:/Users/username/tools/bin:/Users/lz/Documents/playercard-flutter/scripts:/usr/local/Cellar/maven/3.8.6/bin:/Users/username/flutter/bin:/opt/homebrew/Cellar/appium/2.1.3/bin:/bin/date:/usr/bin/dirname
As you can see above, npm executable is in my path. Please let me know if you need any further information to track down this issue.
Are you running your script from a terminal with that PATH? Or are you running from an IDE which might or might not be smart enough to find your terminal PATH? Maybe you need to tell your IDE what PATH or env vars to use?
@jlipps and for the others going through this issue, I had to do two things. I updated my npm path, turns out it was wrong and then I also added the following dependency to my pom.xml file:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.13.0</version>
</dependency>
Hopefully this helps!
@leonelqa can you please describe what you did to fix the npm path that you said you were wrong about? I have still the same issue going on even though I tried everything with paths and env vars, so it would be appreciated if you could explain how you did it in detail! Thank you
@mergimmeholli So I ran the command
which npm
in terminal
The output for me was /opt/homebrew/bin/npm
I then added the path to my .bash_profile like this
#NPM
export PATH="/opt/homebrew/bin/npm:$PATH"
I then ran the source ~/.bash_profile
command in terminal
I also added the following dependency to my pom.xml file
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.13.0</version>
</dependency>
Point to note before this recent issue, I never had to have my path to npm stored in my variables. But initially in my attempt to try and fix the issue I used the wrong path. Use the above as a guide and of course use whatever file you currently use to store your environment variables.
Hope you get it sorted. Reach out if I can help any further.
which npm
in terminalThe output for me was
/opt/homebrew/bin/npm
I then added the path to my .bash_profile like this
#NPM export PATH="/opt/homebrew/bin/npm:$PATH"
Not sure about the proper understanding of PATH. The variable is supposed to contain paths to DIRECTORIES, not FILES.
@mykola-mokhnach
Not sure about the proper understanding of PATH. The variable is supposed to contain paths to DIRECTORIES, not FILES
For my understanding can you explain why the variable should only contain paths for directories as opposed to files too? PS both paths to NPM with executable and directory worked for me.
Thank you for your reply, but this also did not help. In the meantime I have tried quite a lot of things and changed a lot of things trying to get it working but no luck. I uninstalled node from homebrew and installed it through their downloadable solution, and didn't work. Moved to nvm and that also did not work. Currently this is the code where I am getting different errors: Note: Created a main method to run the starter from just to get it running, as when I connect it to tests it always shows "failed to connect" due to server not starting.
AppiumDriverLocalService server = new AppiumServiceBuilder()
.withAppiumJS(new File("/opt/homebrew/lib/node_modules/appium/build/lib/main.js"))
.usingDriverExecutable(new File("/Users/[user]/.nvm/versions/node/v21.1.0/bin/node"))
.withIPAddress("127.0.0.1")
.usingPort(4727)
.withArgument(GeneralServerFlag.BASEPATH, "/wd/hub")
.build();
server.start();
buildAppiumServer().start();
Error:
[Appium] 'npm' executable is not found neither in the process working folder (/Users/[user]/Projects/project) nor in any folders specified in the PATH environment variable (/usr/bin:/bin:/usr/sbin:/sbin). Exception in thread "main" io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: [The local appium server has not been started, Reason: Timed out waiting for [http://127.0.0.1:4727/wd/hub/status] to be available after 20005 ms, Consider increasing the server startup timeout value (currently 20000ms), Node.js executable path: /Users/[user]/.nvm/versions/node/v21.1.0/bin/node, Arguments: [/opt/homebrew/lib/node_modules/appium/build/lib/main.js, --port, 4727, --address, 127.0.0.1, --base-path, /wd/hub/], Output: [Appium] 'npm' executable is not found neither in the process working folder (/Users/[user]/Projects/project) nor in any folders specified in the PATH environment variable (/usr/bin:/bin:/usr/sbin:/sbin) ]
When I use the npm location instead of node:
AppiumDriverLocalService server = new AppiumServiceBuilder()
.withAppiumJS(new File("/opt/homebrew/lib/node_modules/appium/build/lib/main.js"))
.usingDriverExecutable(new File("/Users/[user]/.nvm/versions/node/v21.1.0/bin/npm"))
.withIPAddress("127.0.0.1")
.usingPort(4727)
.withArgument(GeneralServerFlag.BASEPATH, "/wd/hub")
.build();
server.start();
buildAppiumServer().start();
The error:
env: node: No such file or directory Exception in thread "main" io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: [The local appium server has not been started, Reason: Timed out waiting for [http://127.0.0.1:4727/wd/hub/status] to be available after 20006 ms, Consider increasing the server startup timeout value (currently 20000ms), Node.js executable path: /Users/[user]/.nvm/versions/node/v21.1.0/bin/npm, Arguments: [/opt/homebrew/lib/node_modules/appium/build/lib/main.js, --port, 4727, --address, 127.0.0.1, --base-path, /wd/hub/], Output: env: node: No such file or directory ]
When I don't specify the path of node at all in the usingDriverExecutable
:
AppiumDriverLocalService server = new AppiumServiceBuilder()
.withAppiumJS(new File("/opt/homebrew/lib/node_modules/appium/build/lib/main.js"))
.withIPAddress("127.0.0.1")
.usingPort(4727)
.withArgument(GeneralServerFlag.BASEPATH, "/wd/hub")
.build();
server.start();
I get the same error as when I add the node path and not the npm path.
When I don't specify neither the appium location or the node location using something I found online that looks like this:
return new AppiumServiceBuilder().usingAnyFreePort()
.withIPAddress( "127.0.0.1" )
.withArgument( GeneralServerFlag.LOG_LEVEL, "error" )
.withArgument( GeneralServerFlag.RELAXED_SECURITY )
.withArgument( GeneralServerFlag.SESSION_OVERRIDE )
.build();
Here I don't get timeout, but this error:
Exception in thread "main" io.appium.java_client.service.local.InvalidServerInstanceException: Node Package Manager (npm) is either not installed or its executable is not present in PATH
Meanwhile in echo $PATH
I have this:
/Users/[user]/.nvm/versions/node/v21.1.0/bin:/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/bin:/Users/[user]/.nvm/versions/node/v21.1.0/bin/npm:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/homebrew/bin/node:/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/bin:/Users/[user]/Library/Android/sdk/platform-tools:/Users/[user]/Library/Android/sdk/tools:/Users/[user]/Library/Android/sdk/tools/bin:/Users/[user]/Library/Android/sdk/emulator:/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home:/Users/[user]/Library/Android/sdk/platform-tools:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin:/Users/[user]/Library/Android/sdk/tools:/Users/[user]/Library/Android/sdk/platform-tools:/Users/[user]/Library/Android/sdk/tools:/Users/[user]/Library/Android/sdk/platform-tools
And the output of env
is this:
PATH=/Users/[user]/.nvm/versions/node/v21.1.0/bin:/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/bin:/Users/[user]/.nvm/versions/node/v21.1.0/bin/npm:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/homebrew/bin/node:/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/bin:/Users/[user]/Library/Android/sdk/platform-tools:/Users/[user]/Library/Android/sdk/tools:/Users/[user]/Library/Android/sdk/tools/bin:/Users/[user]/Library/Android/sdk/emulator:/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home:/Users/[user]/Library/Android/sdk/platform-tools:/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin:/Users/[user]/Library/Android/sdk/tools:/Users/[user]/Library/Android/sdk/platform-tools:/Users/[user]/Library/Android/sdk/tools:/Users/[user]/Library/Android/sdk/platform-tools
__CFBundleIdentifier=com.jetbrains.intellij.ce
SHELL=/bin/zsh
TERM=xterm-256color
USER=[user]
TMPDIR=/var/folders/ck/854vfh216sn2x8p4zbw39n400000gn/T/
COMMAND_MODE=unix2003
TERMINAL_EMULATOR=JetBrains-JediTerm
LOGIN_SHELL=1
__INTELLIJ_COMMAND_HISTFILE__=/Users/[user]/Library/Caches/JetBrains/IdeaIC2021.1/terminal/history/povio-automated-qa-history1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.3glwTYJik6/Listeners
XPC_FLAGS=0x0
TERM_SESSION_ID=1244e222-9ab0-4f88-96ee-dc5b193bc53c
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
LOGNAME=[user]
LC_CTYPE=en_US.UTF-8
XPC_SERVICE_NAME=0
HOME=/Users/[user]
SHLVL=1
PWD=/Users/[user]/Projects/povio-automated-qa
OLDPWD=/Users/[user]/Projects/povio-automated-qa
ANDROID_HOME=/Users/[user]/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home
HOMEBREW_PREFIX=/opt/homebrew
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
MANPATH=/Users/[user]/.nvm/versions/node/v21.1.0/share/man:/opt/homebrew/share/man::
INFOPATH=/opt/homebrew/share/info:
ANDROID_SDK_ROOT=/Users/[user]/Library/Android/sdk
NODE_PATH=/Users/[user]/.nvm/versions/node/v21.1.0/bin/node
APPIUM_PATH=/opt/homebrew/lib/node_modules/appium
NVM_DIR=/Users/[user]/.nvm
NVM_CD_FLAGS=-q
NVM_BIN=/Users/[user]/.nvm/versions/node/v21.1.0/bin
NVM_INC=/Users/[user]/.nvm/versions/node/v21.1.0/include/node
_=/usr/bin/env
I tried rewriting the code, starting a new project from scratch, uninstall/reinstall, upgrade/downgrade appium and java, but nothing works.
[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)
did you check whether npm is in any of those places?
Hi Bro I'm Also facing this issues how can i resove it?
@Shivam001Gupta I struggled a lot with this issue but ultimately this worked for me: Pre-Requisite-> Install the jenkins NodeJS plugin
This should fix the issue
@vsaxena-sdet where did you install the Jenkins NodeJS plugin? On Eclipse? or on Jenkin?
thanks bro
On Sat, Dec 30, 2023 at 2:53 PM Vaibhav Saxena @.***> wrote:
@Shivam001Gupta https://github.com/Shivam001Gupta I struggled a lot with this issue but ultimately this worked for me:
- Navigate to Jenkins->Manage->Configure->NodeJS installations
- Set the installation dir to "/usr/local" (varies if your location is diff) and give it a name
- Now in your job build environment section, select the checkbox "Provide Node & npm bin/ folder to PATH"
- Restart Jenkins and run it. 5Screenshot.2023-12-30.at.2.49.37.PM.png (view on web) https://github.com/appium/java-client/assets/36469577/7c6c00c6-edee-44c6-92c0-9b9f86c795b9 Screenshot.2023-12-30.at.2.49.24.PM.png (view on web) https://github.com/appium/java-client/assets/36469577/e61242cb-0187-48f3-9be3-a773243e8eeb
This should fix the issue
— Reply to this email directly, view it on GitHub https://github.com/appium/java-client/issues/2037#issuecomment-1872490900, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVYVOHUQKLWHXUCM2U4SDJTYL7MP3AVCNFSM6AAAAAA54MMBRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGQ4TAOJQGA . You are receiving this because you were mentioned.Message ID: @.***>
Exception in thread "main" io.appium.java_client.service.local.InvalidServerInstanceException: Node Package Manager (npm) is either not installed or its executable is not present in PATH.
Have added the npm exec file and bin older both in the path variable.
Facing the same issue issue, while starting appium within an Electron Application. Any workaround for this?
Comment out nvm in the bashrc file, manually set the node path, and then restart.
Do I have the most recent component updates?
Is the component officially supported by the Appium team?
Is there an existing issue for this?
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: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:
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
Environment
appium --version
): 2.0.1node --version
): v20.8.0npm
version (output ofnpm --version
): 10.1.0Link to Appium Logs
No response
Further Information
No response