我在 Linux 上使用节点 5.10.0。运行我的脚本时遇到一些问题,如下所示
[davea@mydevbox mydir]$ node SkyNet.js
Validation Complete
/home/davea/node_modules/selenium-webdriver/chrome.js:185
throw Error(
^
Error: The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
at Error (native)
at new ServiceBuilder (/home/davea/node_modules/selenium-webdriver/chrome.js:185:13)
at getDefaultService (/home/davea/node_modules/selenium-webdriver/chrome.js:362:22)
at Driver (/home/davea/node_modules/selenium-webdriver/chrome.js:771:34)
at Builder.build (/home/davea/node_modules/selenium-webdriver/builder.js:464:16)
at Object.<anonymous> (/home/davea/mydir/js/Optimus.js:14:4)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
它说 chromedriver 不在我的路径上,但我刚刚从这里下载了适当的版本 - http://chromedriver.storage.googleapis.com/index.html?path=2.9/ ,正如你所见,它是在我的路径上
[davea@mydevbox mydir]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/davea/bin:/home/davea/bin:/usr/lib/chromedriver
具有以下权限…
[davea@mydevbox mydir]$ ls -al /usr/lib/chromedriver
-rwxr-xr-x 1 davea evotext 5503600 Feb 3 2014 /usr/lib/chromedriver
所以我很困惑为什么我会收到这个错误。任何帮助表示赞赏, - 戴夫
原文由 Dave 发布,翻译遵循 CC BY-SA 4.0 许可协议
添加到 Niels 的答案中,对于那些不使用 Babel 的人
”`