reactjs 尝试时出错:yarn create vite / yarn create vite my-react-app --template react

r1wp621o  于 2023-06-22  发布在  React
关注(0)|答案(1)|浏览(146)

我已经在我的Windows 10中使用命令npm install --global yarn安装了yarn,并使用yarn --version检查了版本,它在cmd中显示了版本信息。然后我尝试使用命令创建一个vite应用程序:yarn create vite,但在cmd中显示以下错误。如果你知道的话,请给予我答案。我尝试卸载并重新安装yarn,但同样的错误发生。谢谢你。
下面是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 "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>
agxfikkp

agxfikkp1#

我遇到了同样的问题,但找不到通过CLI解决的方法。
如果你真的坚持使用Vite/Yarn组合,我是这样做的:
1.手动转到(这是您问题中的目录)C:\Users\Graphic Doctor\AppData\Local\Yarn\bin\create-vite,然后手动启动create-vite.cmd
1.一个新的命令提示符窗口将弹出,只需按照指示。
1.完成后,您的项目将准备好并位于C:\Users\Graphic Doctor\AppData\Local\Yarn\bin中,只需手动移动它到任何您喜欢的地方即可。
祝你好运!

相关问题