'How to install PhantomJS in R Studio?

I wrote a program that needs to run, the following is my R code:

library(webshot)

webshot("tmp.html","Normal_top100.png", delay =10, vwidth = 1920, vheight=1080) 

However, I got the following message:

PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.

Therefore, I need to install Phantomjs, but I got some problem cannot be solved.

I saw the following link to install it, but I don't know why I still cannot run successfully.

https://www.jianshu.com/p/a7fd378714eb

The website said that you need to set Environment Variable and I used the method of this link. However, when I run this code again, I still got the same error. I suspected the reason is this website is incorrect.

Can anyone help me? Thanks.



Solution 1:[1]

For installing phantomJS you just need to run the following command in the R console:

webshot::install_phantomjs()

It will be downloaded and installed into your default library directory.

For more details please read the documentation: https://rdrr.io/cran/webshot/man/install_phantomjs.html

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 The Doctor