Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Expecting a function in instanceof check, but got undefined #117

Closed
jojohappy opened this issue Feb 5, 2017 · 1 comment
Closed

Comments

@jojohappy
Copy link

运行 font-spider 时报错

Error: Expecting a function in instanceof check, but got undefined
    at /Users/works/font_spider/node_modules/font-spider/src/spider/index.js:277:36
    at cssRuleListFor (/Users/works/font_spider/node_modules/font-spider/src/spider/index.js:348:21)
    at FontSpider.eachCssRuleList (/Users/works/font_spider/node_modules/font-spider/src/spider/index.js:330:13)
    at FontSpider.getWebFonts (/Users/works/font_spider/node_modules/font-spider/src/spider/index.js:276:14)
    at FontSpider.parse (/Users/works/font_spider/node_modules/font-spider/src/spider/index.js:44:29)
    at new FontSpider (/Users/works/font_spider/node_modules/font-spider/src/spider/index.js:27:17)
    at /Users/works/font_spider/node_modules/font-spider/src/spider/index.js:403:20
    at process._tickCallback (node.js:369:9)

无论是全局安装,还是当前目录安装都会有这个错误,经过 DEBUG 后发现,window.CSSFontFaceRule is undefined, 在去掉 if 判断后正常

//if (cssRule instanceof CSSFontFaceRule) {
    var webFont = WebFont.parse(cssRule);
    if (webFont) {
        webFonts.push(webFont);
    }
//}

环境信息如下:

  • macOS 10.12.2
  • Nodejs 4.4.5
  • Npm 3.10.9
  • font-spider 1.3.3
└─┬ font-spider@1.3.3
  ├─┬ browser-x@0.0.1-beta6
  │ ├── css-mediaquery@0.1.2
  │ ├── cssom@0.3.2
  │ ├── cssstyle@0.2.37
  │ ├── nwmatcher@1.3.9
  │ ├── parse5@2.2.3
  │ ├── specificity@0.1.6
  │ └─┬ verror@1.9.0
  │   ├── assert-plus@1.0.0
  │   ├── core-util-is@1.0.2
  │   └── extsprintf@1.3.0
aui pushed a commit that referenced this issue Feb 13, 2017
@aui aui closed this as completed Feb 13, 2017
@imfenghuang
Copy link

@aui

1.3.4

这个报这个错误
Error: Expecting a function in instanceof check, but got undefined

删除上述if可以使用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants