Error when trying: yarn create vite /yarn create vite my-react-app --template react
P粉764003519
2023-08-29 22:59:32
<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>
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:
Good luck!