简体   繁体   中英

URI malformed in React Project - Using Parcel Bundler

I am experimenting with React project and parcel as the bundler. I am getting this error trying to run the command "dev":

Server running at http://localhost:1234 × C:\React\parcelreact\todoapp\public\index.html: URI malformed

This is a standard create-react-app project then added parcel-bundler..

This is my package.json "scripts" {}

 "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 malformed at decodeURIComponent ()

What is the cause of this error? My index.html is indeed inside my public/ folder..

Help.?

The problem is due to all of the values in the public/index.html that create-react-app creates that contains "%PUBLIC_URL%". If you modify these paths to be relative paths to the files they are pointing to you should be able to run your app using Parcel just fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM