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

运行报错 #109

Closed
zongren opened this issue Sep 21, 2016 · 15 comments
Closed

运行报错 #109

zongren opened this issue Sep 21, 2016 · 15 comments

Comments

@zongren
Copy link

zongren commented Sep 21, 2016

网站的目录结构是这样的

/public/css/style.css
/public/fonts/source.ttf
/public/index.html
/public/categories/android/index.html

其中style.css是按照教程写的font-face

@font-face {
  font-family: 'source';
  src: url('../fonts/source.eot');
  src:
    url('../fonts/source.eot?#font-spider') format('embedded-opentype'),
    url('../fonts/source.woff2') format('woff2'),
    url('../fonts/source.woff') format('woff'),
    url('../fonts/source.ttf') format('truetype'),
    url('../fonts/source.svg') format('svg');
  font-weight: normal;
  font-style: normal;
}

/public/index.html/public/categories/android/index.html中的css链接为

<link rel="stylesheet" href="/css/style.css" media="screen" type="text/css">

运行font-spider报以下错误

10:25:23 › font-spider ~/blog/public/*.html --debug
Loading ..
Load: public/README.html
Load: public/baidu_verify_Neaaf6qfNd.html
Load: public/baidu_verify_VWfJTLiWhl.html
Load: public/googlecf611fe761231af4.html
Load: public/index.html
Load: ../../../css/style.css
Load: ../../../css/katex.min.css
DEBUG { "url": "/Users/zongren/blog/public/baidu_verify_Neaaf6qfNd.html" }
DEBUG { "url": "/Users/zongren/blog/public/baidu_verify_VWfJTLiWhl.html" }
Load: ../../../css/style.css
Load: ../../../css/katex.min.css
DEBUG { "url": "/Users/zongren/blog/public/googlecf611fe761231af4.html" }

Error: : ENOENT, load "/css/style.css" failed: ENOENT: no such file or directory, open '/css/style.css'
    at ReadFileContext.onload [as callback] (/usr/local/lib/node_modules/font-spider/node_modules/browser-x/src/utils/resource.js:71:30)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:303:13)

zongren at zongrendeMacbookPro15.local in [~/blog]  on git:master ✗  dfdaa20 "Update"
10:26:30 › 
@zongren zongren changed the title label:question 运行报错 运行报错 Sep 21, 2016
@zongren
Copy link
Author

zongren commented Sep 21, 2016

貌似是把/css/style.css全部当作绝对路径了

@zongren
Copy link
Author

zongren commented Sep 21, 2016

将路径全部换成绝对路径后

<link rel="stylesheet" href="https://zongren.me/css/style.css" media="screen" type="text/css">

再执行font-spider命令,报以下错误

11:14:32 › font-spider public/*.html --debug --map "https://zongren.me/fonts /Users/zongren/blog/public/fonts"
Loading ..
Load: public/404.html
Load: public/README.html
Load: public/baidu_verify_Neaaf6qfNd.html
Load: public/baidu_verify_VWfJTLiWhl.html
Load: public/googlecf611fe761231af4.html
Load: public/index.html
Load: https://zongren.me/css/error.css
Load: https://zongren.me/css/katex.min.css
Load: https://zongren.me/css/style.css
Load: https://zongren.me/css/katex.min.css
DEBUG { "url": "/Users/zongren/blog/public/baidu_verify_VWfJTLiWhl.html" }
DEBUG { "url": "/Users/zongren/blog/public/baidu_verify_Neaaf6qfNd.html" }
DEBUG { "url": "/Users/zongren/blog/public/googlecf611fe761231af4.html" }
Load: https://zongren.me/css/style.css
Load: https://zongren.me/css/katex.min.css
...
Loading ...

Error: does not support remote path "https://zongren.me/fonts/source.eot?"
    at /usr/local/lib/node_modules/font-spider/src/compressor/index.js:38:23
    at Array.forEach (native)
    at Compress.<anonymous> (/usr/local/lib/node_modules/font-spider/src/compressor/index.js:36:23)
    at new Compress (/usr/local/lib/node_modules/font-spider/src/compressor/index.js:24:12)
    at /usr/local/lib/node_modules/font-spider/src/compressor/index.js:230:16
    at Array.map (native)
    at module.exports (/usr/local/lib/node_modules/font-spider/src/compressor/index.js:229:37)
    at /usr/local/lib/node_modules/font-spider/bin/font-spider:174:16
    at process._tickCallback (node.js:369:9)

@zongren
Copy link
Author

zongren commented Sep 21, 2016

css路径更改为相对路径

<link rel="stylesheet" href="css/style.css" media="screen" type="text/css">

并且对单个文件执行font-spider命令,成功执行

font-spider public/index.html

@zongren
Copy link
Author

zongren commented Sep 21, 2016

目前的解决办法是
先把/css/style.css改为/Users/zongren/blog/public/css/style.css
执行font-spider命令后,再改回来

@zongren zongren closed this as completed Sep 21, 2016
@aui
Copy link
Owner

aui commented Sep 22, 2016

问题本质是 font-spider 无法识别 /css/style.css 这种绝对路径,它找不到文件。开发阶段建议使用相对路径,发布阶段改成绝对路径就没有问题了

@zongren
Copy link
Author

zongren commented Sep 22, 2016

了解

@appleyuchi
Copy link

@aui @zongren 两位大神,问题是这样的文件在hexo的public中非常多啊,怎么一次性解决啊?
谢谢

@appleyuchi
Copy link

@aui 他这个public是发布阶段了已经,不可能每次都这么改啊,那就太麻烦了啊

@zongren
Copy link
Author

zongren commented Jun 20, 2019

@aui 他这个public是发布阶段了已经,不可能每次都这么改啊,那就太麻烦了啊

使用脚本自动修改的

@zongren
Copy link
Author

zongren commented Jun 20, 2019

@appleyuchi 类似这种
image

@appleyuchi
Copy link

@zongren 作者已经没在维护了吧,一大堆的issue.
而且我还碰到这样的问题:
(python3.6) appleyuchi@ubuntu:public$ font-spider index.html
Error: does not support remote path "https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/fonts/KaTeX_AMS-Regular.woff2"

您看应该怎么办呢?谢谢

@appleyuchi
Copy link

@zongren 按照您说的改成绝对路径了,不行啊,报错依旧

@appleyuchi
Copy link

@zongren
大神,您说的/css/style.css改为/Users/zongren/blog/public/css/style.css只能解决:
Error: : ENOENT, load "/css/style.css" failed: ENOENT: no such file or directory, open '/css/style.css'
并不能解决
Error: does not support remote path "https://zongren.me/fonts/source.eot?"

我碰到的是这个:
“Error: does not support remote path "https://cdn.bootcss.com/font-awesome/4.6.3/fonts/fontawesome-webfont.eot?"

您看咋办呢?感谢

@zongren
Copy link
Author

zongren commented Jun 21, 2019

@zongren
大神,您说的/css/style.css改为/Users/zongren/blog/public/css/style.css只能解决:
Error: : ENOENT, load "/css/style.css" failed: ENOENT: no such file or directory, open '/css/style.css'
并不能解决
Error: does not support remote path "https://zongren.me/fonts/source.eot?"

我碰到的是这个:
“Error: does not support remote path "https://cdn.bootcss.com/font-awesome/4.6.3/fonts/fontawesome-webfont.eot?"

您看咋办呢?感谢

你这是图标吧,本来也不需要处理,看看能不能忽略这个错误

@appleyuchi
Copy link

已经解决,附上链接,谢谢两位大神:
https://blog.csdn.net/appleyuchi/article/details/93362783

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