gpt4 book ai didi

google-chrome - list : Line: 1, 列 : 1, 语法错误; React.js:通过键入 npm start 在浏览器中打开它时屏幕为空白或白色

转载 作者:行者123 更新时间:2023-12-05 06:57:57 25 4
gpt4 key购买 nike

我在 cosole 上遇到以下错误...

无法加载资源:net::ERR_NAME_NOT_RESOLVED

无法加载资源:服务器响应状态为 400(错误请求)

list :行:1,列:1,语法错误

整个浏览器屏幕都是白色的,没有数据显示

以下是我的manifest.json文件

{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

这是我的 indext.html 文件中的链接标签

<link rel="manifest" crossorigin="use-credentials" href="%PUBLIC_URL%/manifest.json" />

我已经完成了工作 list ,但问题仍然存在......

  1. 删除 node_modulespackage.lock.json 文件并在我的终端运行 npm install

  2. crossorigin="use-credentials"添加到public文件夹indext.html的link标签中

  3. manifest.json 上编辑了以下对象

    {"start_url": "./",“显示”:“独立”,"theme_color": "#000000",“背景颜色”:“#ffffff”

但还没有解决....

最佳答案

有时这种类型的错误可能是由于损坏的文件或依赖项造成的。在那种情况下,我认为目前为止最好的选择是通过新安装的 React 重新启动您的项目,并将所有这些文件从过去的项目复制到您的新项目中。

让我们试试看会发生什么;

  npx  i create-react-app "create-new-one"

然后

 cd "create-new-one"

最后,在新创建的文件中按顺序或结构方式复制文件和文件夹,看看是否启动

npm start

现在所有与 manifest.json 相关的问题都将消失

注意:在我的例子中,我做了同样的方式,刚刚说的和后果,从中删除

关于google-chrome - list : Line: 1, 列 : 1, 语法错误; React.js:通过键入 npm start 在浏览器中打开它时屏幕为空白或白色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64767548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com