Meteor:无法解码下载的字体和 OTS 解析错误 - 版本标签无效

Meteor: failed to decode downloaded font and OTS parsing error - invalid version tag

我已经开始在我的流星项目中使用 twbs:boostrap 包中的 glyphicons。自从我开始使用它们以来,我一直在我的控制台中收到以下警告:

Failed to decode downloaded font: http://localhost:3000/fonts/glyphicons-halflings-regular.woff2
OTS parsing error: invalid version tag
Failed to decode downloaded font: http://localhost:3000/fonts/glyphicons-halflings-regular.woff
OTS parsing error: invalid version tag
Failed to decode downloaded font: http://localhost:3000/fonts/glyphicons-halflings-regular.ttf
OTS parsing error: invalid version tag

这是什么原因造成的?我该如何抑制这些警告或解决问题? glyphicons 工作得很好,不过总是看到警告真是太痛苦了。

这意味着您用于导入 glyphicons 的包中有错误,没有正确声明字体文件的位置,或者没有将字体文件正确添加到包本身。

检查包维护者问题跟踪器,同时,将字形下载到您的 public 目录并在您自己的 CSS 文件中声明它们。

在尝试了许多其他方法、大量重新安装并检查 meteor 和 npm 配置之后,我刚刚通过清除 Chrome(缓存的图像和文件)中的浏览数据解决了这个问题,然后刷新页面。

Serkan Durusoy 的上述回答对我有用,但这里有一些关于我必须做的事情的更多细节。

  1. 将字体文件从 node_modules/bootstrap/dist/fonts 复制到 public/fonts

  2. 将此添加到我的 main.css:

    @font-face { 字体系列:'Glyphicons Halflings'; 来源:url('fonts/glyphicons-halflings-regular.eot'); src: url('fonts/glyphicons-halflings-regular.eot?#iefix') 格式('embedded-opentype'), url('fonts/glyphicons-halflings-regular.woff2') 格式('woff2'), url( 'fonts/glyphicons-halflings-regular.woff') 格式('woff'), url('fonts/glyphicons-halflings-regular.ttf') 格式('truetype'), url('fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') 格式( 'svg'); }

我从 node_modules/bootstrap/dist/css/bootstrap.css 复制了 css 并更改了路径以匹配我放置字体的位置。