Vega 官网: https://vega.github.io/vega/
安装问题
前端项目里安装 npm install vega
会报一个包404错误,官方给的回复是暂时忽略
https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.0/canvas-prebuilt-v1.6.0-node-v64-linux-x64.tar.gz 地址在github中已经不存在了
gyw@gyw:~/sda1/code/exercise/my-project$ npm install vega -D
> canvas-prebuilt@1.6.0 install /home/gyw/sda1/code/exercise/my-project/node_modules/canvas-prebuilt
> node-pre-gyp install
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.0/canvas-prebuilt-v1.6.0-node-v64-linux-x64.tar
.gz
node-pre-gyp ERR! stack at Request.<anonymous> (/home/gyw/sda1/code/exercise/my-project/node_modules/node-pre-gyp/lib/install.js:118:27)
node-pre-gyp ERR! stack at Request.emit (events.js:187:15)
node-pre-gyp ERR! stack at Request.onRequestResponse (/home/gyw/sda1/code/exercise/my-project/node_modules/node-pre-gyp/node_modules/request/request.js:1074:10)
node-pre-gyp ERR! stack at ClientRequest.emit (events.js:182:13)
node-pre-gyp ERR! stack at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:538:21)
node-pre-gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
node-pre-gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:425:20)
node-pre-gyp ERR! stack at TLSSocket.emit (events.js:182:13)
node-pre-gyp ERR! stack at addChunk (_stream_readable.js:277:12)
node-pre-gyp ERR! stack at readableAddChunk (_stream_readable.js:262:11)
node-pre-gyp ERR! System Linux 4.13.0-39-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/gyw/sda1/code/exercise/my-project/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /home/gyw/sda1/code/exercise/my-project/node_modules/canvas-prebuilt
node-pre-gyp ERR! node -v v10.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.0/canvas-prebuilt-v1.6.0-node-v64-linux-x64.tar.gz
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: canvas-prebuilt@1.6.0 (node_modules/canvas-prebuilt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: canvas-prebuilt@1.6.0 install: `node-pre-gyp install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ vega@4.0.0-rc.1
updated 1 package in 13.23s
引入问题
前端工程中必须这样引入 import * as vega from 'vega'
使用 import vega from 'vega'
的方式会报错