'Error: not found: java Usage: selenium-standalone action [options]

trying to install selenium-standalone but getting this error, any idea?

$ ./node_modules/.bin/selenium-standalone install

not found: java
Usage: selenium-standalone action [options]

I have java installed but don't know if it needs to be in a specific file location.

Bootcamp Student 2@DESKTOP-AI3C36U MINGW64 ~/Desktop/Webdriverframework
$ npm install -save-dev [email protected]                                                                      npm WARN [email protected] No repository field.

+ [email protected]
added 18 packages from 18 contributors and audited 493 packages in 6.873s
found 0 vulnerabilities


Bootcamp Student 2@DESKTOP-AI3C36U MINGW64 ~/Desktop/Webdriverframework
$ ./node_modules/.bin/selenium-standalone install                                                                       not found: java
Usage: selenium-standalone action [options]

It should install and then I should be able to start it.



Solution 1:[1]

You mention having Java installed, but you didn't mention whether Java was in your PATH environment variable. Add a JAVA_HOME environment variable and then add %JAVA_HOME%\bin to your PATH environment variable.

Solution 2:[2]

As It is clearly showing the usage error Usage: selenium-standalone action [options] chances are that, you might be not passing any arguments after selenium-standalone command. Or a newLine/linebreak is being passed

Try giving or type the following in one go and then press enter

./node_modules/.bin/selenium-standalone install

It should work fine.

Refer https://www.npmjs.com/package/selenium-standalone for more info

Solution 3:[3]

Just installing java worked for me. Run in the terminal this:

sudo apt update
sudo apt install default-jre

then run again

selenium-standalone install && selenium-standalone start

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John M
Solution 2 Madhan
Solution 3 marciofao