[英]"gatsby develop" can't run After adjusting image data
I'm very new Gatsbyjs user.我是 Gatsbyjs 的新用户。 Currently I use this template
目前我使用这个模板
https://www.gatsbyjs.com/starters/netlify-templates/gatsby-starter-netlify-cms https://www.gatsbyjs.com/starters/netlify-templates/gatsby-starter-netlify-cms
My nodejs version is v16.13.2我的nodejs版本是v16.13.2
I could "gatsby develop" but I think when I'm adjusting photo data in "page-data.json" which stored public\page-data\index I "gatsby develop" won't start我可以“盖茨比开发”,但我认为当我在“page-data.json”中调整存储公共\页面数据\索引的照片数据时,我“盖茨比开发”将无法启动
I'm not sure what is cause but I'm sure when I add some image data into public\img and changed lines "coffee.png" in "page-data.json" this happened...我不确定是什么原因,但我确定当我将一些图像数据添加到 public\img 并更改“page-data.json”中的“coffee.png”行时,这发生了......
Here is error message.这是错误消息。 Could someone teach me what part should I fix please?
有人可以教我应该修复哪个部分吗?
warn Plugin gatsby-plugin-netlify is not compatible with your gatsby version 4.3.0 - It requires gatsby@^3.0.0
⠋ open and validate gatsby-configs, load plugins
C:\Users\myname\AppData\Roaming\npm\node_modules\gatsby-cli\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
throw ex;
^
Error: read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:220:20)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4077,
code: 'ECONNRESET',
syscall: 'read'
}
I could "gatsby develop" but I think when I'm adjusting photo data in "page-data.json" which stored public\page-data\index I "gatsby develop" won't start
我可以“盖茨比开发”,但我认为当我在“page-data.json”中调整存储公共\页面数据\索引的照片数据时,我“盖茨比开发”将无法启动
You should never edit manually the content or the code inside the /public
folder directly.您不应该直接手动编辑
/public
文件夹中的内容或代码。 Keep in mind how Gatsby works : when you run gatsby develop
or gatsby build
, webpack compiles and bundles everything under /src
folder to create the /public
one: this is autogenerated and rebuild when you change anything on your /src
folder.请记住Gatsby 的工作原理:当您运行
gatsby develop
或gatsby build
时,webpack 会编译并捆绑/src
文件夹下的所有内容以创建/public
文件夹:当您更改/src
文件夹中的任何内容时,它会自动生成并重建。 If you change anything inside the public folder manually without changing the source, it will be lost in the next compilation because the source doesn't includes the changes.如果您手动更改公用文件夹中的任何内容而不更改源,它将在下一次编译中丢失,因为源不包含更改。 So, all changes must be done in the
/src
folder.因此,所有更改都必须在
/src
文件夹中完成。
In this case, the error is rising because you changed the public folder directly so the references of the assets page-data.json
have changed.在这种情况下,错误正在上升,因为您直接更改了公用文件夹,因此资产
page-data.json
的引用已更改。
To change the coffee.png
image, you need to change the static folder.要更改
coffee.png
图像,您需要更改 static 文件夹。 The static folder is a "special" folder that is cloned inside the public folder keeping the exact internal structure. static 文件夹是一个“特殊”文件夹,它被克隆到公用文件夹中,并保持准确的内部结构。 As the name suggests, is very useful to use for static assets (the ones that rarely change).
顾名思义,用于 static 资产(很少更改的资产)非常有用。
Once you change the coffe.png
image for your desired one, you just need to change the references of coffee.png
to the new one (unless they are called the same).将
coffe.png
图像更改为所需图像后,只需将coffee.png
的引用更改为新的(除非它们被称为相同)。
That said, this kind of static change may force you to reload the gatsby develop
(stop and rerun) process to see the changes.也就是说,这种 static 更改可能会迫使您重新加载
gatsby develop
(停止并重新运行)过程以查看更改。 If the image still without changing, clean the cache by running gatsby clean
before rerunning the gatsby develop
command.如果图像仍然没有更改,请在重新运行
gatsby develop
命令之前通过运行gatsby clean
缓存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.