在 Windows 上从 vega(node.js 模块)安装 v2png 程序

shr*_*sgm 5 r node.js vega ggvis

export_png()R ggvis 包中的函数要求我们vg2png从 node.js 模块安装程序vega。(来源:R 文档

我在 Windows 上安装了 node 和 npm,然后运行了npm install vega.

这是我运行的输出npm install vega

C:\Users\username>npm install -g trifacta/vega
\


> canvas@1.1.6 install C:\Users\username\AppData\Roaming\npm\node_modules\vega\node_modules\canvas
> node-gyp rebuild

|
C:\Users\username\AppData\Roaming\npm\node_modules\vega\node_modules\canvas>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bi
n\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Node Commands

Syntax:
    node {operator} [options] [arguments]

Parameters:
        /? or /help   - Display this help message.
        list          - List nodes or node history or the cluster
        listcores     - List cores on the cluster
        view          - View properties of a node
        online        - Set nodes or node to online state
        offline       - Set nodes or node to offline state
        pause         - Pause node [deprecated]
        resume        - Resume node [deprecated]

For more information about HPC command-line tools,
see http://go.microsoft.com/fwlink/?LinkId=120724.
C:\Users\username\AppData\Roaming\npm\vg2svg -> C:\Users\username\AppData\Roaming\npm\node_modules\vega\bin\vg2svg
C:\Users\username\AppData\Roaming\npm\vg2png -> C:\Users\username\AppData\Roaming\npm\node_modules\vega\bin\vg2png
vega@1.5.0 C:\Users\username\AppData\Roaming\npm\node_modules\vega
??? yargs@2.3.0 (wordwrap@0.0.2)
??? canvas@1.1.6 (nan@1.2.0)
??? d3@3.5.5
??? request@2.53.0 (caseless@0.9.0, json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign2@0.5.0, stringstream@0.0.4, oauth-sign@0.6.0, tunnel-agen
t@0.4.0, isstream@0.1.2, node-uuid@1.4.3, qs@2.3.3, combined-stream@0.0.7, form-data@0.2.0, tough-cookie@0.12.1, mime-types@2.0.10, http-signature@0.1
0.1, hawk@2.3.1, bl@0.9.4)
??? topojson@1.6.18 (queue-async@1.0.7, rw@0.1.4, optimist@0.3.7, shapefile@0.3.0)
??? d3-geo-projection@0.2.14 (brfs@1.4.0)
Run Code Online (Sandbox Code Playgroud)

我不确定它是否已正确安装。现在,当我运行时:

mtcars %>% 
  ggvis(x = ~wt) %>% 
  export_png()
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

写入文件 plot.png

vega_file(vis, file = file, type = "png") 中的错误:

未找到转换程序 vg2png。

是否有一种特定的方式必须在 Windows 上安装 vega,以解决此错误?