我试着跑CCapture.js https://github.com/spite/ccapture.js via node.js
基本代码(用于测试)为
global.navigator = {userAgent: 'node.js'};
global.window = new Object();
var ccaptureJs = require("ccapture.js");
但是当我执行该文件时node cap.js
(上面的代码)在终端中,它给出了错误:
$ node cap.js
/home/tika/node_modules/ccapture.js/build/CCapture.all.min.js:1
(function (exports, require, module, __filename, __dirname) { function download(t,e,n){function i(t){var e=t.split(/[:;,]/),n=e[1],i="base64"==e[2]?atob:decodeURIComponent,r=i(e.pop()),o=r.length,a=0,s=new Uint8Array(o);for(a;a<o;++a)s[a]=r.charCodeAt(a);return new m([s],{type:n})}function r(t,e){if("download"in l)return l.href=t,l.setAttribute("download",w),l.innerHTML="downloading...",l.style.display="none",f.body.appendChild(l),setTimeout(function(){l.click(),f.body.removeChild(l),e===!0&&setTimeout(function(){h.URL.revokeObjectURL(l.href)},250)},66),!0;var n=f.createElement("iframe");f.body.appendChild(n),e||(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,d)),n.src=t,setTimeout(function(){f.body.removeChild(n)},333)}var o,a,s,h=window,d="application/octet-stream",u=n||d,c=t,f=document,l=f.createElement("a"),p=function(t){return String(t)},m=h.Blob||h.MozBlob||h.WebKitBlob||p,g=h.MSBlobBuilder||h.WebKitBlobBuilder||h.BlobBuilder,w=e||"download";if
TypeError: Cannot read property 'toLowerCase' of undefined
at Object.<anonymous> (/home/tika/node_modules/ccapture.js/build/CCapture.all.min.js:1:16590)
at e (/home/tika/node_modules/ccapture.js/build/CCapture.all.min.js:1:10557)
at Object.<anonymous> (/home/tika/node_modules/ccapture.js/build/CCapture.all.min.js:1:11348)
at e (/home/tika/node_modules/ccapture.js/build/CCapture.all.min.js:1:10557)
at Object.<anonymous> (/home/tika/node_modules/ccapture.js/build/CCapture.all.min.js:1:19591)
at Object.<anonymous> (/home/tika/node_modules/ccapture.js/build/CCapture.all.min.js:1:19609)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)