sinanbekar / browser-extension-react-typescript-starter

🚀 React & TypeScript Starter for developing web extensions with hot reload!
MIT License
136 stars 20 forks source link

Invalid Path Characters Error on `yarn dev` #69

Open MiiKOME opened 4 months ago

MiiKOME commented 4 months ago

Description

I encountered an error when attempting to start the development server using yarn dev. The error message indicates that there are invalid characters in the file path, which prevents the server from starting.

Steps to Reproduce

  1. Clone the repository.
  2. Run yarn install to install dependencies.
  3. Run yarn dev to start the development server.

Expected Behavior

The development server should start successfully and listen on the specified port.

Actual Behavior

The following error occurs:

yarn dev yarn run v1.22.22 $ run-s clean && vite $ run-p clean:* $ rimraf dist $ rimraf dist-firefox-v2

VITE v4.3.9 ready in 878 ms

➜ Local: http://localhost:3573/ ➜ Network: use --host to expose ➜ press h to show help E:\Cex\browser-extension-react-typescript-starter\node_modules@crxjs\vite-plugin\node_modules\fs-extra\lib\mkdirs\utils.js:16 const error = new Error(Path contains invalid characters: ${pth}) ^

Error: Path contains invalid characters: E:/Cex/browser-extension-react-typescript-starter/src/E:\Cex\browser-extension-react-typescript-starter\dist/content at checkPath (E:\Cex\browser-extension-react-typescript-starter\node_modules@crxjs\vite-plugin\node_modules\fs-extra\lib\mkdirs\utils.js:16:21) at module.exports.makeDir (E:\Cex\browser-extension-react-typescript-starter\node_modules@crxjs\vite-plugin\node_modules\fs-extra\lib\mkdirs\make-dir.js:12:3) at Object. (E:\Cex\browser-extension-react-typescript-starter\node_modules\universalify\index.js:22:13) at E:\Cex\browser-extension-react-typescript-starter\node_modules@crxjs\vite-plugin\node_modules\fs-extra\lib\output-file\index.js:20:11 at E:\Cex\browser-extension-react-typescript-starter\node_modules\universalify\index.js:22:54 { code: 'EINVAL' }

Node.js v20.6.1 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment Information

Additional Information

I have tried running the command prompt with administrator privileges, but the issue persists. It seems that there is a mix of forward slashes (/) and backslashes (\) in the file path, which might be causing the issue.

Any guidance or solutions would be greatly appreciated.

andriy-panchiy commented 4 months ago

UP

andriy-panchiy commented 3 months ago

I had the following config where I also had this problem: image

the only thing is that the script: run-s clean && tsc && vite build worked as it should and without errors. Accordingly, I tried changing the code to: image

this fix helped and now the run-s clean && vite command works but at the same time it broke the run-s clean && tsc && vite build script

also what I noticed is that if you apply the latest change, if you have content_scripts in your manifest with a reference to content/index.tsx, the content folder and all the necessary scripts will not be generated, causing an install error extension that this script was not found