Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript URIError:无法解码参数'/&书信电报;myusername>/&书信电报;项目名称>;/%PUBLIC_URL%/manifest.json';_Javascript_Reactjs_Uri - Fatal编程技术网

Javascript URIError:无法解码参数'/&书信电报;myusername>/&书信电报;项目名称>;/%PUBLIC_URL%/manifest.json';

Javascript URIError:无法解码参数'/&书信电报;myusername>/&书信电报;项目名称>;/%PUBLIC_URL%/manifest.json';,javascript,reactjs,uri,Javascript,Reactjs,Uri,我正在尝试恢复一年半前编写的React旧应用程序 我克隆了它并安装了所有依赖项,但当我执行“npm启动”时,它只加载一个空白页并抛出错误: “URIError:未能解码参数'///%PUBLIC_URL%/manifest.json'” 老实说,我不知道该从这里走到哪里 以下是my package.json的外观: { "name": "nosmallstreamer", "version": "1.0.0"

我正在尝试恢复一年半前编写的React旧应用程序

我克隆了它并安装了所有依赖项,但当我执行“npm启动”时,它只加载一个空白页并抛出错误:

“URIError:未能解码参数'///%PUBLIC_URL%/manifest.json'”

老实说,我不知道该从这里走到哪里

以下是my package.json的外观:

{
  "name": "nosmallstreamer",
  "version": "1.0.0",
  "description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
  "main": "index.js",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/chaselancaster/nosmallstreamer-frontend.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/chaselancaster/nosmallstreamer-frontend/issues"
  },
  "homepage": "https://github.com/chaselancaster/nosmallstreamer-frontend#readme",
  "dependencies": {
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^4.0.0"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
以下是公用文件夹中my index.html的外观:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" /> -->
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <!--
      manifest.json provides metadata used when your web app is installed on a
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
    -->
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->
    <title>React App</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
  </body>
</html>
{
  "short_name": "React App",
  "name": "Create React App Sample",
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "64x64 32x32 24x24 16x16",
      "type": "image/x-icon"
    }
  ],
  "start_url": ".",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff"
}

感谢您的帮助

在index.html中,尝试更改

<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

致:



这可能是在不弹出项目的情况下解决此问题的唯一方法。

尝试将
package.json
文件中的
主页更改为:
“/”
,而不是使用GitHub repo的URL
react脚本运行
(这是npm start
运行的内容)似乎将
主页
中的域用作应用程序的根目录。

这看起来像是最初使用Create react app创建的。我假设它有一个
公共文件夹。它的内容是什么?它包含index.html和manifest.json!你能编辑你的问题并提供index.html吗?现在就添加它!试过了,但没有成功!由于某些原因,项目的全名不会显示在URL栏中。它显示为“”。然而,该项目的名称是“nosmallstreamer前端”。这跟这事有关系吗?
<link rel="manifest" href="/public/manifest.json" />