当我使用 create 命令时,纱线总是以错误结束

问题描述

每次尝试使用 yarn 运行 create 命令时都会遇到同样的错误,例如 create-react-app:

PS M:\Users\Michael\Documents\GitHub\test> yarn create react-app test-app --template typescript
yarn create v1.22.11
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and Failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-react-app@4.0.3" with binaries:
      - create-react-app
The filename,directory name,or volume label Syntax is incorrect.
error Command Failed.
Exit code: 1
Command: M:\Users\Michael\Documents\GitHub\test\!\bin\create-react-app
Arguments: test-app --template typescript
Directory: M:\Users\Michael\Documents\GitHub\test
Output:

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

也许我需要一些环境变量?

解决方法

此错误来自 Windows。

我通过全局安装 create-react-app 并使用它来创建应用程序而不是 npx 来修复它。