在mac上但在Debian上使用rvest和V8的R脚本

在mac上但在Debian上使用rvest和V8的R脚本,r,debian,v8,R,Debian,V8,我有一个脚本,它在我的mac上Rstudio运行得非常完美。但如果我试图在Debian或docker上运行它,它会给我这个错误 Error in context_eval(join(src), private$context, serialize) : ReferenceError: window is not defined Calls: <Anonymous> ... <Anonymous> -> evaluate_js -> get_str_outp

我有一个脚本,它在我的mac上Rstudio运行得非常完美。但如果我试图在Debian或docker上运行它,它会给我这个错误

Error in context_eval(join(src), private$context, serialize) :
  ReferenceError: window is not defined
Calls: <Anonymous> ... <Anonymous> -> evaluate_js -> get_str_output -> context_eval
上下文评估中出现错误(join(src),private$context,serialize): ReferenceError:未定义窗口 电话:…->评估\u js->获取\u str\u输出->上下文\u评估 剧本

library(rvest) 
library(dplyr)
library(V8)

ctx <- v8(global="window")

page <- read_html('https://finance.yahoo.com/quote/WORK') 
js <- html_nodes(page, "script")[60] %>% 
  html_text() %>% 
  stri_replace_first_fixed("(function (root) {", "var root = { App : {}};\n") %>% 
  stri_replace_last_fixed("}(this));", "")


ctx$eval(JS(js))
slaper <- ctx$get('root', flatten=TRUE)
库(rvest)
图书馆(dplyr)
图书馆(V8)
ctx%
stri_replace_last_fixed(“}(this));”,“”)
ctx$eval(JS(JS))
拍打者