无法从 eclipse 错误 "windows cannot find lighthouse" 使用进程生成器运行灯塔 cli



有没有人使用Google Chrome Lighthouse的Node CLI版本来收集性能指标。 我可以从命令行毫无问题地做到这一点。 当我尝试从 Eclipse 通过 Process Builder 运行相同的命令时,它无法识别命令灯塔。请找到我遵循的以下步骤。

1( 下载了适用于 Windows 的 nodejs msi 安装程序

2( 自动设置 Nodejs 和 npm 路径。我确实仔细检查了一下。

我能够使用以下命令获取节点和 npm 版本:

node -v
v8.12.0
npm -v
6.4.1

我按照此处的建议使用以下命令来安装带有 -g 标志的灯塔以安装为全局模块。

npm install -g lighthouse

用于从 eclipse 运行灯塔的示例 Java 代码:

import java.io.IOException;

public class Invoke_Lighthouse {
public static void main(String[] args) {
Process p;
{
try {

p = Runtime.getRuntime().exec("cmd /c start /wait lighthouse  http://demo.testfire  --output json --output-path ./light.json  --disable-device-emulation --throttling-method=provided");
} catch (IOException  e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

我不断收到错误"Windows找不到灯塔"。 相同的命令正在通过命令行工作。我正在尝试在这里自动化事情。我希望这在 Java 中工作。我在这里错过了什么吗,任何关于这方面的建议都会非常有帮助。提前谢谢。

Runtime.getRuntime((.exec("cmd.exe/c lighthouse http://demo.testfire"(

最新更新