在Jenkins上运行nodejs测试用例时未找到java

在Jenkins上运行nodejs测试用例时未找到java,jenkins,jenkins-pipeline,webdriver-io,Jenkins,Jenkins Pipeline,Webdriver Io,我在Jenkins中运行了Node js回归测试用例,但它遇到了一个“java未找到问题”,我假设这是因为我没有实现java,但我尝试了“安装java”、“安装Javac”,但都失败了。有什么解决方案吗?或者我应该在Jenkins中配置Java吗?你能帮我一下吗? 我使用的命令如下: ./node_modules/.bin/wdio config/e2e.js --selenium-started --suite myestSuite describe('OI Overview Page '

我在Jenkins中运行了Node js回归测试用例,但它遇到了一个“java未找到问题”,我假设这是因为我没有实现java,但我尝试了“安装java”、“安装Javac”,但都失败了。有什么解决方案吗?或者我应该在Jenkins中配置Java吗?你能帮我一下吗? 我使用的命令如下:

 ./node_modules/.bin/wdio config/e2e.js --selenium-started --suite myestSuite
describe('OI Overview Page ', function () {
  const landingPage = new OverviewPage(true);
  it(`Should Load`, function () {
    landingPage.addLocalStorage();
    ........//omit here
  });
})
配置如下所示:

const wdioConf = {  specs: [],
  suites: {
    myestSuite: [ './test/regression/mytest-overview-flow.js ]
  }
}
A service failed in the 'onPrepare' hook
Error: not found: java
 at getNotFoundError (/home/jenkins/agent/workspace/node_modules/selenium-standalone/node_modules/which/which.js:10:17)
 at Function.whichSync [as sync] (/home/jenkins/agent/workspace/selenium-standalone/node_modules/which/which.js:121:9)
 at Object.start (/home/jenkins/agent/workspace/node_modules/selenium-standalone/lib/start.js:56:27)
测试用例如下:

 ./node_modules/.bin/wdio config/e2e.js --selenium-started --suite myestSuite
describe('OI Overview Page ', function () {
  const landingPage = new OverviewPage(true);
  it(`Should Load`, function () {
    landingPage.addLocalStorage();
    ........//omit here
  });
})
错误日志如下所示:

const wdioConf = {  specs: [],
  suites: {
    myestSuite: [ './test/regression/mytest-overview-flow.js ]
  }
}
A service failed in the 'onPrepare' hook
Error: not found: java
 at getNotFoundError (/home/jenkins/agent/workspace/node_modules/selenium-standalone/node_modules/which/which.js:10:17)
 at Function.whichSync [as sync] (/home/jenkins/agent/workspace/selenium-standalone/node_modules/which/which.js:121:9)
 at Object.start (/home/jenkins/agent/workspace/node_modules/selenium-standalone/lib/start.js:56:27)

正如您所猜测的,您的runner中缺少Java。你在用什么发行版?您可以查找特定发行版的JRE安装命令。通常
install Java
不会删除它。