Home  >  Q&A  >  body text

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

<p>I have installed yarn in Windows 10 using the command <code>npm install --global yarn</code> and checked the version using <code>yarn --version</code> and it Shows the version information in the command. Then I tried to create a vite application using the following command: <code>yarn create vite</code> but it showed the following error in cmd. If you know please give me the solution. I tried uninstalling and reinstalling yarn but the same error occurred. Thanks. </p> <p>This is an error in cmd: </p> <pre class="brush:php;toolbar:false;">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 "create-vite@4.3.2" 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></pre></p>
P粉764003519P粉764003519438 days ago705

reply all(1)I'll reply

  • P粉511985082

    P粉5119850822023-08-30 20:29:17

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

    If you really insist on using the Vite/Yarn combo, here’s how I do it:

    1. Manually go to (this is the directory in your question) C:\Users\Graphic Doctor\AppData\Local\Yarn\bin\create-vite and manually start create-vite.cmd
    2. A new command prompt window will pop up, just follow the instructions.
    3. Once completed, your project will be ready and located in C:\Users\Graphic Doctor\AppData\Local\Yarn\bin, just manually move it to your preferred location.

    Good luck!

    reply
    0
  • Cancelreply