【问题标题】:URI malformed in React Project - Using Parcel BundlerReact 项目中的 URI 格式错误 - 使用 Parcel Bundler
【发布时间】:2021-04-19 01:24:10
【问题描述】:

我正在尝试将 React 项目和 parcel 作为捆绑器。 我在尝试运行命令“dev”时遇到此错误:

服务器运行在 http://localhost:1234 × C:\React\parcelreact\todoapp\public\index.html: URI 格式错误

这是一个标准的 create-react-app 项目,然后添加了 parcel-bundler..

这是我的 package.json “脚本”{}

 "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "dev": "parcel public/index.html",
    "run": "parcel build index.html"
  },

C:\React\parcelreact\todoapp\public\index.html:URI 格式错误 在 decodeURIComponent()

这个错误的原因是什么? 我的 index.html 确实在我的 public/ 文件夹中..

帮助。?

【问题讨论】:

  • 你有没有想过这个问题?我正在尝试做同样的事情并收到同样的错误。

标签: reactjs parcel


【解决方案1】:

问题是由于 create-react-app 创建的 public/index.html 中的所有值都包含“%PUBLIC_URL%”。如果您将这些路径修改为它们指向的文件的相对路径,您应该能够使用 Parcel 运行您的应用程序就好了。

【讨论】:

  • 非常感谢布赖恩!我很感激
猜你喜欢
  • 2019-08-10
  • 2020-04-22
  • 1970-01-01
  • 2019-09-12
  • 2020-11-02
  • 2020-04-09
  • 1970-01-01
  • 2019-06-29
  • 1970-01-01
相关资源
最近更新 更多