The gatsby plugin prefetch fonts throws this error suddenly starts to throw the error Error: ENOENT: no such file or directory, stat '.cache/google-fonts//fonts'
Install the last version of the plugin and try to run.
Error should not be throwed.
When start the application on development it throws this
ERROR #11321 PLUGIN
"gatsby-plugin-prefetch-google-fonts" threw an error while running the onPreBootstrap lifecycle:
ENOENT: no such file or directory, stat '.cache/google-fonts//fonts'
Error: ENOENT: no such file or directory, stat '.cache/google-fonts//fonts'
- api-runner-node.js:460 Promise.catch.decorateEvent.pluginName
[project]/[gatsby]/src/utils/api-runner-node.js:460:9
- From previous event:
- api-runner-node.js:459
[project]/[gatsby]/src/utils/api-runner-node.js:459:14
- timers.js:461 processImmediate
internal/timers.js:461:21
- From previous event:
- api-runner-node.js:451
[project]/[gatsby]/src/utils/api-runner-node.js:451:13
- From previous event:
- api-runner-node.js:367 module.exports
[project]/[gatsby]/src/utils/api-runner-node.js:367:3
- initialize.ts:413 initialize
[project]/[gatsby]/src/services/initialize.ts:413:9
{
name: 'gatsby-starter-default',
description: 'Gatsby default starter',
'dist-tags': {
next: '1.0.0',
latest: '1.0.0'
},
versions: [
'1.0.0'
],
maintainers: [
{
name: 'davekrstin',
email: '[email protected]'
}
],
time: {
modified: '2017-11-16T18:32:55.888Z',
created: '2017-11-16T18:32:55.888Z',
'1.0.0': '2017-11-16T18:32:55.888Z'
},
keywords: [
'gatsby'
],
author: {
name: 'Alecell',
email: '[email protected]'
},
license: 'MIT',
readmeFilename: 'README.md',
version: '1.0.0',
dependencies: {
gatsby: '^1.9.99',
'gatsby-link': '^1.6.24',
'gatsby-plugin-react-helmet': '^1.0.8'
},
main: 'n/a',
scripts: {
build: 'gatsby build',
develop: 'gatsby develop',
start: 'concurrently "gatsby develop" "json-server --watch ../playground/src/components/StatefulShell/configs/remote-config.json"',
format: 'prettier --trailing-comma es5 --no-semi --single-quote --write "src/**/*.js"',
test: 'echo "Error: no test specified" && exit 1'
},
devDependencies: {
concurrently: '^3.5.0',
prettier: '^1.7.4'
},
dist: {
integrity: 'sha512-nn5DNZ5dbwcDe2TmTQb1JRoLOe9hB8LhGOvLq5LU6UgApsn3MQMwhT7cACrxd+yD2V+pk0oTu9w6uL66olnSmg==',
shasum: '7d4a555f5a824bcfc876554b82ea839e190d2295',
tarball: 'https://registry.npmjs.org/gatsby-starter-default/-/gatsby-starter-default-1.0.0.tgz'
},
directories: {}
}
I am also getting this error. how to resolve this issue
@Alecell how did you resolve this issue?
Hey guys, since the plugin isnt owned by gatsby
I close the ussue, but I don't "solve" the issue, as the gatsby-plugin-prefetch-google-fonts
is much deprecated and it was archived, so I have no choice but search for another plugin that does the trick, luckily gatsby-plugin-webfonts still update and solve the issue.
It occured when updating
from "gatsby": "^2.21.33",
to "gatsby": "^2.25.1",
My solution was, removing the prefetch plugin and using this https://www.gatsbyjs.com/plugins/gatsby-plugin-google-fonts/. Rewrote gatsby-config.js. Working now.
It happened to me because I was gatsby develop
in another terminal while trying to run gatsby build
If anyone runs into this issue, then I recommend using : "gatsby-plugin-preload-fonts"
Here's a youtube video on how to set it up :
https://www.youtube.com/watch?v=i2oquvFdzbg&t=279s
@Alecell gatsby-plugin-webfonts has a bug where browser downloads both woff2 and woff formats.I opened an issue there but the repo is not maintained. I end up manually adding font inside onRenderBody ssr handler.
I had the same issue.
1) updated npm and gatsby
2) install the npm install gatsby-plugin-google-fonts --save
3) configure on my gatsby config
4) it works correctly.
thanks for sharing with us
I've got the same issue. Replaced with gatsby-plugin-preload-fonts. Shared my experience here
Most helpful comment
It occured when updating
from
"gatsby": "^2.21.33",
to "
gatsby": "^2.25.1",
My solution was, removing the prefetch plugin and using this https://www.gatsbyjs.com/plugins/gatsby-plugin-google-fonts/. Rewrote gatsby-config.js. Working now.