22

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?

2 Answers 2

49

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

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

0
3

In Windows 10, I manually installed vite to a react project and got this same error.

My solution was to replace "%PUBLIC_URL%" with "public" in the URLs inside the index.html file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.