0

当我在 Windows 上使用节点 15 创建一个反应应用程序时,如下所示:

yarn create react-app my-project --template typescript

它失败了

yarn create v1.22.11
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.6: The platform "win32" is incompatible with this module.
info "fsevents@2.0.6" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/4] ⠁ waiting...
[-/4] ⠁ waiting...
[3/4] ⠂ deasync
error C:\Users\teyc\AppData\Local\Yarn\Data\global\node_modules\deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments:
Directory: C:\Users\teyc\AppData\Local\Yarn\Data\global\node_modules\deasync
Output:
C:\Users\teyc\AppData\Local\Yarn\Data\global\node_modules\deasync>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@15.0.1 | win32 | x64
gyp info find Python using Python version 3.7.3 found at "C:\Users\teyc\AppData\Local\Programs\Python\Python37-32\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.8.30717.126) found at:

我不想安装编译器。是否有可供下载的二进制文件?

4

1 回答 1

0

不幸的是,deasync 节点包可能不包含您的节点版本和操作系统的每个二进制文件,并且yarn由于某些莫名其妙的原因在运行时需要它,create react-appnpx没有。

您的选择是:

  1. 弄清楚如何将预构建的二进制文件下载到您的系统中

https://github.com/abbr/deasync-bin

  1. 利用npx
npx create react-app my-project --template typescript
  1. 使用纱线 2。这是我更喜欢的方法,因为它消耗的磁盘空间更少
yarn set version berry
yarn create react-app myproject --template typescript
于 2021-08-21T23:22:06.050 回答