reactjsnpmnpm-start

Error URI malformed when running react application on mac


I am trying to run React app locally.

When running npm run dev I get error

 vite v2.6.14 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 182ms.

/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:56882
        let url = decodeURI(removeTimestampQuery(req.url)).replace(NULL_BYTE_PLACEHOLDER, '\0');
                  ^

URIError: URI malformed
    at decodeURI (<anonymous>)
    at viteTransformMiddleware (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:56882:19)
    at call (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:45568:7)
    at next (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:45512:5)
    at /Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:56525:28
    at viteServePublicMiddleware (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:56564:9)
    at call (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:45568:7)
    at next (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:45512:5)
    at next (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:45490:14)
    at next (/Users/markoz/Work/Razvoj/Graphs/kenstack-designer/kenstack-designer/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:45490:14)

Node.js v17.4.0

I don't have .npmrc on my system folder, but I have one inside the project.

How can I fix the issue?


Solution

  • remove "%PUBLIC_URL%" in "public/index.html".

    https://github.com/vitejs/vite/issues/6482