Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while trying: yarn create vite / yarn create vite my-react-app --template react

I've installed yarn in my Windows 10 using the command npm install --global yarn and checked the version using yarn --version , It's showing the version info in the cmd. And then I tried to create a vite app using the command : yarn create vite but It shows the below error in the cmd. Please give me the solution if you know. I tried uninstalling and re-installing yarn but the same error happens. Thank you.

Here is the error in cmd:

C:\DevProjects>yarn create vite
yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "[email protected]" with binaries:
      - create-vite
      - cva
[##] 2/2'C:\Users\Graphic' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\Users\Graphic Doctor\AppData\Local\Yarn\bin\create-vite
Arguments:
Directory: C:\DevProjects
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

C:\DevProjects>
like image 670
HAFIJ AL ASAD Avatar asked Apr 14 '26 02:04

HAFIJ AL ASAD


2 Answers

I had the same problem and couldn't find a way to solve it through the CLI.

If you really insist on using Vite/Yarn combo, here is how I did it:

  1. Manually go to (this is the directory from your question) C:\Users\Graphic Doctor\AppData\Local\Yarn\bin\create-vite and manually start the create-vite.cmd
  2. A new Command Prompt window will pop-up, just follow the instructions.
  3. After you're done, your project will be ready and located in C:\Users\Graphic Doctor\AppData\Local\Yarn\bin, just manually move it wherever you like.

Good luck!

like image 196
A Rsv Avatar answered Apr 16 '26 14:04

A Rsv


building on top of @a-rsv's answer, So I was able to successfully run the command by running as below

"C:\Users\Graphic Doctor\AppData\Local\Yarn\bin\create-vite.cmd"

I just executed the .cmd file. This will run the cmd in the current directory so you won't have to move anything after. You need to wrap the command with double quotes if you have spaces in the path.

like image 40
Shehanmark Avatar answered Apr 16 '26 16:04

Shehanmark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!